Szerző Téma: /givecash  (Megtekintve 530 alkalommal)

Swat

  • Vendég
/givecash
« Dátum: 2012. február 05. - 19:23:52 »
0 Show voters
hello all
szeretnék kérni egy /givecash scriptet keresstem de nem találtam

Nem elérhető nyE

  • 1745
    • Profil megtekintése
/givecash
« Válasz #1 Dátum: 2012. február 05. - 19:29:08 »
+1 Show voters
Az alap szervercsomag lvdm.pwn-ben benne van.
De mivel nincs jobb dolgom leírom neked . . .
[pawn]#include <a_samp>
#define COLOR_YELLOW 0xFFFF00AA
#define COLOR_WHITE 0xFFFFFFAA
public OnPlayerCommandText(playerid, cmdtext[])
{
    new string[256];
new playermoney;
new sendername[MAX_PLAYER_NAME];
new giveplayer[MAX_PLAYER_NAME];
new cmd[256];
new giveplayerid, moneys, idx;
cmd = strtok(cmdtext, idx);
    if(strcmp(cmd, \"/givecash\", true) == 0)
{
    new tmp[256];
   tmp = strtok(cmdtext, idx);
   if(!strlen(tmp)) {
      SendClientMessage(playerid, COLOR_WHITE, \"USAGE: /givecash [playerid] [amount]\");
      return 1;
   }
   giveplayerid = strval(tmp);
   tmp = strtok(cmdtext, idx);
   if(!strlen(tmp)) {
      SendClientMessage(playerid, COLOR_WHITE, \"USAGE: /givecash [playerid] [amount]\");
      return 1;
   }
       moneys = strval(tmp);
   //printf(\"givecash_command: %d %d\",giveplayerid,moneys);
   if (IsPlayerConnected(giveplayerid)) {
      GetPlayerName(giveplayerid, giveplayer, sizeof(giveplayer));
      GetPlayerName(playerid, sendername, sizeof(sendername));
      playermoney = GetPlayerMoney(playerid);
      if (moneys > 0 && playermoney >= moneys) {
         GivePlayerMoney(playerid, (0 - moneys));
         GivePlayerMoney(giveplayerid, moneys);
         format(string, sizeof(string), \"You have sent %s(player: %d), $%d.\", giveplayer,giveplayerid, moneys);
         SendClientMessage(playerid, COLOR_YELLOW, string);
         format(string, sizeof(string), \"You have recieved $%d from %s(player: %d).\", moneys, sendername, playerid);
         SendClientMessage(giveplayerid, COLOR_YELLOW, string);
         printf(\"%s(playerid:%d) has transfered %d to %s(playerid:%d)\",sendername, playerid, moneys, giveplayer, giveplayerid);
      }
      else {
         SendClientMessage(playerid, COLOR_YELLOW, \"Invalid transaction amount.\");
      }
   }
   else {
         format(string, sizeof(string), \"%d is not an active player.\", giveplayerid);
         SendClientMessage(playerid, COLOR_YELLOW, string);
      }
   return 1;
}
return 0;
}
strtok(const string[], &index)
{
new length = strlen(string);
while ((index < length) && (string[index] <= \' \'))
{
   index++;
}
new offset = index;
new result[20];
while ((index < length) && (string[index] > \' \') && ((index - offset) < (sizeof(result) - 1)))
{
   result[index - offset] = string[index];
   index++;
}
result[index - offset] = EOS;
return result;
}[/pawn]

Nem elérhető Dead

  • 2045
    • Profil megtekintése
/givecash
« Válasz #2 Dátum: 2012. február 06. - 16:15:12 »
0 Show voters

 

SimplePortal 2.3.7 © 2008-2024, SimplePortal