sscanf question , how to do this ? - 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)
+---- Forum: Help Archive (
https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: sscanf question , how to do this ? (
/showthread.php?tid=185338)
sscanf question , how to do this ? -
Dj_maryo1993 - 24.10.2010
pawn Код:
new giveplayer[20];
if (!sscanf(params, "i",giveplayer )||!sscanf(params, "s[20]",giveplayer))
{
new para1;
para1 = ReturnUser(giveplayer);
//bla bla rest of the code
}
It works ok but only for the name of the player , if i give the playerid it doesn't work (invalid playerid) .
Re: sscanf question , how to do this ? -
Whizion - 24.10.2010
Uhm, what do you want to do with this? Post te full command.
Re: sscanf question , how to do this ? -
Dj_maryo1993 - 24.10.2010
pawn Код:
COMMAND:uninvite(playerid, params[])
{
if(PlayerInfo[playerid][Leader] > 0)
{
new giveplayer[20];
if (!sscanf(params, "i",giveplayer )||!sscanf(params, "s[20]",giveplayer))
{
new para1;
para1 = ReturnUser(giveplayer);
if(para1 != INVALID_PLAYER_ID)
{
if (PlayerInfo[para1][Loggedin] != 0)
{
if (PlayerInfo[para1][Faction] == PlayerInfo[playerid][Leader])
{
new sendername[MAX_PLAYER_NAME];
new string[56];
GetPlayerName(playerid, sendername, sizeof(sendername));
format(string, sizeof(string), "%s Has uninvited you from his faction",sendername);
SendClientMessage(para1,culoare,string);
PlayerInfo[para1][Faction] = 0;
SetPlayerSkin(para1,25);
return 1;
}
else
{
SendClientMessage(playerid, culoare, "ERROR : That player is not in your faction");
return 1;
}
}
else
{
SendClientMessage(playerid, culoare, "ERROR: Player Not logged in");
return 1;
}
}
else
{
SendClientMessage(playerid, culoare, "ERROR : Invalid player");
return 1;
}
}
else
{
SendClientMessage(playerid, culoare, "Use : /invite [playerid]");
return 1;
}
}
return 1;
}
Re: sscanf question , how to do this ? -
Whizion - 24.10.2010
Try this:
pawn Код:
COMMAND:uninvite(playerid, params[])
{
if(PlayerInfo[playerid][Leader] > 0)
{
new player;
if (sscanf(params, "u",player))
{
new player;
if(player != INVALID_PLAYER_ID)
{
if (PlayerInfo[player][Loggedin] != 0)
{
if(PlayerInfo[player][Faction] == PlayerInfo[playerid][Leader])
{
new string[56];
new sendername[MAX_PLAYER_NAME];
GetPlayerName(playerid, sendername, sizeof(sendername));
format(string, sizeof(string), "%s Has uninvited you from his faction",sendername);
SendClientMessage(player,culoare,string);
PlayerInfo[player][Faction] = 0;
SetPlayerSkin(player,25);
return 1;
}
else
{
SendClientMessage(playerid, culoare, "ERROR : That player is not in your faction");
}
}
else
{
SendClientMessage(playerid, culoare, "ERROR: Player Not logged in");
}
}
}
else
{
SendClientMessage(playerid, culoare, "Use : /invite [playerid]");
}
}
return 1;
}
Re: sscanf question , how to do this ? -
Dj_maryo1993 - 24.10.2010
Yep , that works , thanx .