What did i fuck up lmao - Printable Version
+- SA-MP Forums Archive (
https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (
https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (
https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: What did i fuck up lmao (
/showthread.php?tid=572320)
What did i fuck up lmao -
minijackc - 27.04.2015
Код:
CMD:geo(playerid, params[])
{
new string[128], playa, geo, geo2, geo3;
if(sscanf(params, "ud", playa))
{
SendClientMessageEx(playerid, COLOR_GREY, "USAGE: /geo [player]");
return 1;
}
if (PlayerInfo[playerid][pAdmin] >= 4)
{
if(IsPlayerConnected(playa))
{
if(playa != INVALID_PLAYER_ID)
{
GetPlayerCountry(playerid, string[], const len = sizeof(geo));
GetPlayerISP(playerid, string[], const len = sizeof(geo2));
GetPlayerCity(playerid, string[], const len = sizeof(geo3));
format(string, sizeof(string), "Looking up %s's GEO.. COUNTRY:%s ISP:%S CITY:%s .", GetPlayerNameEx(playa), geo, geo2, geo3);
SendClientMessageEx(playerid, COLOR_WHITE, string);
}
}
}
else
{
Invalid_Admin(playerid);
}
return 1;
}
the errors i got
Код:
./includes/commands.pwn(1700) : error 029: invalid expression, assumed zero
./includes/commands.pwn(1700) : error 029: invalid expression, assumed zero
./includes/commands.pwn(1700) : error 017: undefined symbol "len"
./includes/commands.pwn(1700) : fatal error 107: too many error messages on one line
Compilation aborted.Pawn compiler 3.2.3664 Copyright © 1997-2006, ITB CompuPhase
4 Errors.
Re: What did i fuck up lmao -
BroZeus - 27.04.2015
Don't just copy paste the format of GetPlayerCountry() and other functions, you have to put the name of string in place of
string[]
And also just use 'u' parameter in sscanf, don't use 'd'.
So use this :
PHP код:
CMD:geo(playerid, params[])
{
new string[128], playa, geo[50], geo2[50], geo3[50];//geo, geo2 and geo3 should be string
if(sscanf(params, "u", playa))//only 'u' here
{
SendClientMessageEx(playerid, COLOR_GREY, "USAGE: /geo [player]");
return 1;
}
if (PlayerInfo[playerid][pAdmin] >= 4)
{
if(IsPlayerConnected(playa))
{
if(playa != INVALID_PLAYER_ID)
{
GetPlayerCountry(playerid, geo);//see changes here
GetPlayerISP(playerid, geo2);//see changes here
GetPlayerCity(playerid, geo3);//see changes here
format(string, sizeof(string), "Looking up %s's GEO.. COUNTRY:%s ISP:%S CITY:%s .", GetPlayerNameEx(playa), geo, geo2, geo3);
SendClientMessageEx(playerid, COLOR_WHITE, string);
}
}
}
else
{
Invalid_Admin(playerid);
}
return 1;
}
Re: What did i fuck up lmao -
minijackc - 27.04.2015
Thanks brother Rep+