/giveweed
#1

Whats wrong with this? It is supose to give the player 1+ weed (I have my own weed system)

Код:
if(!strcmp(cmdtext,"/giveweed",true, 9))
{
  if(!strlen(cmdtext[9])) return SendClientMessage(playerid, 0xFF0000AA, "USAGE: /giveweed [playerid]");
  if(hasweed[playerid] <= 0) return SendClientMessage(playerid,0xFF0000AA,"You don't have any weed to give out!");
  new giveid = strval(cmdtext[10]);
  if(!IsPlayerConnected(giveid)) return SendClientMessage(playerid, 0xFF0000AA, "That player isnt connected");
new string[128], string2[128];
new adminname[MAX_PLAYER_NAME], bringname[MAX_PLAYER_NAME];
GetPlayerName(giveid, givename, sizeof(givename));
GetPlayerName(playerid, adminname, sizeof(adminname));
format(string,sizeof(string),">> You have given %s 1 unit of weed", givename);
SendClientMessage(playerid,0xFF8000FF, string);
format(string2,sizeof(string2),">> You have received 1 unit of weed from %s ", adminname);
SendClientMessage(giveid,0xFF8000FF, string2);
GivePlayerMoney(giveid,-1000);
GivePlayerMoney(playerid, 1000);
hasweed[giveid]++;
hasweed[playerid]--;
return 1;

}
Код:
C:\Documents and Settings\Salim\Desktop\SalsTestinGrounds\SalsTestingGrounds.pwn(720) : warning 219: local variable "string" shadows a variable at a preceding level
C:\Documents and Settings\Salim\Desktop\SalsTestinGrounds\SalsTestingGrounds.pwn(722) : error 017: undefined symbol "givename"
C:\Documents and Settings\Salim\Desktop\SalsTestinGrounds\SalsTestingGrounds.pwn(722) : error 017: undefined symbol "givename"
C:\Documents and Settings\Salim\Desktop\SalsTestinGrounds\SalsTestingGrounds.pwn(722) : error 029: invalid expression, assumed zero
C:\Documents and Settings\Salim\Desktop\SalsTestinGrounds\SalsTestingGrounds.pwn(722) : fatal error 107: too many error messages on one line

Compilation aborted.Pawn compiler 3.2.3664	 	 	Copyright © 1997-2006, ITB CompuPhase


4 Errors.
Reply
#2

new givename[MAX_PLAYER_NAME];
Reply
#3

Quote:
Originally Posted by RKS_
new givename[MAX_PLAYER_NAME];
Код:
C:\Documents and Settings\Salim\Desktop\SalsTestinGrounds\SalsTestingGrounds.pwn(721) : warning 219: local variable "string" shadows a variable at a preceding level
C:\Documents and Settings\Salim\Desktop\SalsTestinGrounds\SalsTestingGrounds.pwn(722) : warning 204: symbol is assigned a value that is never used: "bringname"
Reply
#4

pawn Код:
new givename[MAX_PLAYER_NAME];
You're missing this. And you have 'string' already defined somewhere.
Also 'bringname' is never used.
Reply
#5

pawn Код:
if(!strcmp(cmdtext,"/giveweed",true, 9))
{
  new givename[MAX_PLAYER_NAME];
  if(!strlen(cmdtext[9])) return SendClientMessage(playerid, 0xFF0000AA, "USAGE: /giveweed [playerid]");
  if(hasweed[playerid] <= 0) return SendClientMessage(playerid,0xFF0000AA,"You don't have any weed to give out!");
  new giveid = strval(cmdtext[10]);
  if(!IsPlayerConnected(giveid)) return SendClientMessage(playerid, 0xFF0000AA, "That player isnt connected");
  new string2[128];
  new adminname[MAX_PLAYER_NAME];
  GetPlayerName(giveid, givename, sizeof(givename));
  GetPlayerName(playerid, adminname, sizeof(adminname));
  format(string,sizeof(string),">> You have given %s 1 unit of weed", givename);
  SendClientMessage(playerid,0xFF8000FF, string);
  format(string2,sizeof(string2),">> You have received 1 unit of weed from %s ", adminname);
  SendClientMessage(giveid,0xFF8000FF, string2);
  GivePlayerMoney(giveid,-1000);
  GivePlayerMoney(playerid, 1000);
  hasweed[giveid]++;
  hasweed[playerid]--;
  return 1;
}
I added
pawn Код:
new givename[MAX_PLAYER_NAME];
and if you guys looked at the other errors, it said that he didn't need
pawn Код:
new string[128];
so i deleted that.
Reply
#6

Код:
C:\Documents and Settings\Salim\Desktop\SalsTestinGrounds\SalsTestingGrounds.pwn(714) : warning 217: loose indentation
C:\Documents and Settings\Salim\Desktop\SalsTestinGrounds\SalsTestingGrounds.pwn(716) : warning 219: local variable "givename" shadows a variable at a preceding level
C:\Documents and Settings\Salim\Desktop\SalsTestinGrounds\SalsTestingGrounds.pwn(722) : warning 204: symbol is assigned a value that is never used: "bringname"
C:\Documents and Settings\Salim\Desktop\SalsTestinGrounds\SalsTestingGrounds.pwn(722 -- 735) : warning 217: loose indentation
C:\Documents and Settings\Salim\Desktop\SalsTestinGrounds\SalsTestingGrounds.pwn(848) : warning 203: symbol is never used: "givename"
Pawn compiler 3.2.3664	 	 	Copyright © 1997-2006, ITB CompuPhase


5 Warnings.
Reply
#7

are those warnings from my version?
Reply
#8

Ahh froget it :/ I got a bigger problem

I am trying to make this script give 1+ Weed to everyone and 25,000+ cash to everyone and send a message to everyone, i do not want any color on the message, Just a plain old message sent to everyone..I need help becouse i only know how to give it to my self but not to all

Код:
if(!strcmp(cmdtext,"/Freeweedforall",true))
  {
  SendClientMessageToAll("Everyone gets some weed for playing on the server, And 30,000");
  hasweed[playerid]++;
  GivePlayerMoney(playerid,25000);
  return 1;
}
Reply
#9

loop it....
Reply
#10

Quote:
Originally Posted by RKS_
loop it....
I dont understand a thing <.>
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)