Help me please -
Mecie_Jam - 15.02.2013
I put this code
Код:
CMD:sellak(playerid, params[])
{
new playerb, bullets, string[128];
if(!IsPlayerInRangeOfPoint(playerid,7, 2799.7219,-2417.6570,13.6307)) return SendClientMessage(playerid,-1,"You are not at the right place!");
new PlayerName[MAX_PLAYER_NAME];
GetPlayerName(playerid, playerame, sizeof(playername));
if(strfind(playername, "[SC]", true) != -1)
if(sscanf(params,"ii",playerb,bullets)) return SendClientMessage(playerid,-1,"Usage: /sellak [id] [ammo]");
if(!IsPlayerNearPlayer(playerid, playerb, 5.0)) return SendClientMessage(playerid,-1,"You are too far away from that player!");
format(string, sizeof(string), "** %s takes out a AK-47 and a box of ammo as he passes it to %s", NAMEGET(playerid), NAMEGET(playerb), bullets);
NearMessageSender(playerid, 7, string, COLOR_FADE1,COLOR_FADE1,COLOR_FADE1,COLOR_FADE1,COLOR_FADE1);
format(string, sizeof(string), "Gun Dealer %s has given you a AK-47 and a box of ammo.", NAMEGET(playerid));
SendClientMessage(playerb, COLOR_RED, string);
GivePlayerWeapon(playerb, 30, bullets);
GivePlayerMoney(playerid, -200);//you can change the ammount of money taken from the player
return 1;
}
and I get this errors
Код:
C:\Users\Giannis\Desktop\RP.pwn(310) : error 017: undefined symbol "playerame"
C:\Users\Giannis\Desktop\RP.pwn(310) : error 017: undefined symbol "playername"
C:\Users\Giannis\Desktop\RP.pwn(310) : error 029: invalid expression, assumed zero
C:\Users\Giannis\Desktop\RP.pwn(310) : fatal error 107: too many error messages on one line
And I already have puted this Stock
Код:
stock NAMEGET(playerid)
{
new name[MAX_PLAYER_NAME];
GetPlayerName(playerid,name,sizeof(name));
for(new i = 0; i < MAX_PLAYER_NAME; i++)
{
if(name[i] == '_') name[i] = ' ';
}
return name;
Re: Help me please -
Boooth - 15.02.2013
pawn Код:
CMD:sellak(playerid, params[])
{
new playerb, bullets, string[128];
if(!IsPlayerInRangeOfPoint(playerid,7, 2799.7219,-2417.6570,13.6307)) return SendClientMessage(playerid,-1,"You are not at the right place!");
new playername[MAX_PLAYER_NAME];
GetPlayerName(playerid, playername, sizeof(playername));
if(strfind(playername, "[SC]", true) != -1)
if(sscanf(params,"ii",playerb,bullets)) return SendClientMessage(playerid,-1,"Usage: /sellak [id] [ammo]");
if(!IsPlayerNearPlayer(playerid, playerb, 5.0)) return SendClientMessage(playerid,-1,"You are too far away from that player!");
format(string, sizeof(string), "** %s takes out a AK-47 and a box of ammo as he passes it to %s", NAMEGET(playerid), NAMEGET(playerb), bullets);
NearMessageSender(playerid, 7, string, COLOR_FADE1,COLOR_FADE1,COLOR_FADE1,COLOR_FADE1,COLOR_FADE1);
format(string, sizeof(string), "Gun Dealer %s has given you a AK-47 and a box of ammo.", NAMEGET(playerid));
SendClientMessage(playerb, COLOR_RED, string);
GivePlayerWeapon(playerb, 30, bullets);
GivePlayerMoney(playerid, -200);//you can change the ammount of money taken from the player
return 1;
}
EDIT: I would have optimised it for you but I'm on my phone at the moment, if you PM me ill optimise it when I'm at my PC
Re: Help me please -
zxc1 - 15.02.2013
The arrays name are case sensitive, if you named it like this: "PlayerName", it cannot be changed. If it will be changed, it simply won't be recognized.
pawn Код:
GetPlayerName(playerid, PlayerName, sizeof(PlayerName));
Re: Help me please -
Boooth - 15.02.2013
zxc1, That is a string buddy but yes you are right, they are case sensitive.
Re: Help me please -
Mecie_Jam - 15.02.2013
Booth you are the best +Reped bro thank you<33(no homo)
Re: Help me please -
Boooth - 15.02.2013
No worries, I'll optimise the code for you and PM it through.