Formatting - 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: Formatting (
/showthread.php?tid=186555)
Formatting -
Garc1a - 29.10.2010
Quote:
format(string, sizeof(string), "AdmCmd: %s has jailed %s, reason: %s", name, giveplayerid, (result));
|
It doesn't say the person who has been jailed's name in-game, help please.
Re: Formatting -
DeathOnaStick - 29.10.2010
Quote:
Originally Posted by Garc1a
It doesn't say the person who has been jailed's name in-game, help please.
|
Where are the names of the players stored in?
Like 'name[MAX_PLAYERNAME]' and 'AdminName[MAX_PLAYERNAME]'.
Re: Formatting -
0ne - 29.10.2010
instead of giveplayerid, try using: name(giveplayerid)
Re: Formatting -
Garc1a - 29.10.2010
Whole command:
pawn Code:
if(strcmp(cmd, "/ajail", true) == 0)
{
if(PlayerInfo[playerid][pLogged] == 1)
{
if(PlayerInfo[playerid][pAdmin] >= 1)
{
tmp = strtok(cmdtext, idx);
if(!strlen(tmp))
{
SendClientMessage(playerid, COLOR_WHITE, "[Command]: /ajail [playerid] [minutes] [Reason]");
return 1;
}
new playa;
new jailtime;
playa = ReturnUser(tmp);
tmp = strtok(cmdtext, idx);
if(!strlen(tmp))
{
SendClientMessage(playerid, COLOR_WHITE, "[Command]: /ajail [playerid] [minutes] [Reason]");
return 1;
}
jailtime = strval(tmp);
new length = strlen(cmdtext);
while ((idx < length) && (cmdtext[idx] <= ' '))
{
idx++;
}
new offset = idx;
new result[64];
while ((idx < length) && ((idx - offset) < (sizeof(result) - 1)))
{
result[idx - offset] = cmdtext[idx];
idx++;
}
result[idx - offset] = EOS;
if(!strlen(result))
{
SendClientMessage(playerid, COLOR_WHITE, "[Command]: /ajail [playerid] [Jailtime] [Reason]");
return 1;
}
new name[MAX_PLAYER_NAME];
if(IsPlayerConnected(playa))
{
if(playa != INVALID_PLAYER_ID)
{
GetPlayerName(playa, giveplayer, sizeof(giveplayer));
GetPlayerName(playerid, name, sizeof(name));
format(string, sizeof(string), "AdmCmd: %s has jailed %s, reason: %s", name, giveplayerid, (result));
SendClientMessageToAll(COLOR_LIGHTRED, string);
PlayerInfo[playa][pJailed] = 1;
PlayerInfo[playa][pJailTime] = jailtime*60;
SetPlayerInterior(playa, 6);
SetPlayerPos(playa, 264.6288,77.5742,1001.0391);
}
else SendClientMessage(playerid, COLOR_LIGHTRED, "[Error]: That player is not connected!");
}
else SendClientMessage(playerid, COLOR_LIGHTRED, "[Error]: That player is not connected!");
}
else SendClientMessage(playerid, COLOR_LIGHTRED, "[Error]: You're not allowed to use that command!");
}
else SendClientMessage(playerid, COLOR_LIGHTRED, "[Error]: You're not logged in!");
return 1;
}
Re: Formatting -
DeathOnaStick - 29.10.2010
Quote:
Originally Posted by Garc1a
Whole command:
pawn Code:
if(strcmp(cmd, "/ajail", true) == 0) { if(PlayerInfo[playerid][pLogged] == 1) { if(PlayerInfo[playerid][pAdmin] >= 1) { tmp = strtok(cmdtext, idx); if(!strlen(tmp)) { SendClientMessage(playerid, COLOR_WHITE, "[Command]: /ajail [playerid] [minutes] [Reason]"); return 1; } new playa; new jailtime; playa = ReturnUser(tmp); tmp = strtok(cmdtext, idx); if(!strlen(tmp)) { SendClientMessage(playerid, COLOR_WHITE, "[Command]: /ajail [playerid] [minutes] [Reason]"); return 1; } jailtime = strval(tmp); new length = strlen(cmdtext); while ((idx < length) && (cmdtext[idx] <= ' ')) { idx++; } new offset = idx; new result[64]; while ((idx < length) && ((idx - offset) < (sizeof(result) - 1))) { result[idx - offset] = cmdtext[idx]; idx++; } result[idx - offset] = EOS; if(!strlen(result)) { SendClientMessage(playerid, COLOR_WHITE, "[Command]: /ajail [playerid] [Jailtime] [Reason]"); return 1; } new name[MAX_PLAYER_NAME]; if(IsPlayerConnected(playa)) { if(playa != INVALID_PLAYER_ID) { GetPlayerName(playa, giveplayer, sizeof(giveplayer)); GetPlayerName(playerid, name, sizeof(name)); format(string, sizeof(string), "AdmCmd: %s has jailed %s, reason: %s", name, giveplayerid, (result)); SendClientMessageToAll(COLOR_LIGHTRED, string); PlayerInfo[playa][pJailed] = 1; PlayerInfo[playa][pJailTime] = jailtime*60; SetPlayerInterior(playa, 6); SetPlayerPos(playa, 264.6288,77.5742,1001.0391); } else SendClientMessage(playerid, COLOR_LIGHTRED, "[Error]: That player is not connected!"); } else SendClientMessage(playerid, COLOR_LIGHTRED, "[Error]: That player is not connected!"); } else SendClientMessage(playerid, COLOR_LIGHTRED, "[Error]: You're not allowed to use that command!"); } else SendClientMessage(playerid, COLOR_LIGHTRED, "[Error]: You're not logged in!"); return 1; }
|
Did you actually declare 'giveplayerid'? Because I don't find a declaration in this code.
Re: Formatting -
Garc1a - 29.10.2010
Quote:
Originally Posted by DeathOnaStick
Did you actually declare 'giveplayerid'? Because I don't find a declaration in this code.
|
I just downloaded it, it's a FS.
If it isn't declared how do I declare it?