26.08.2012, 03:48
Hello. It's 3am and I'm still having trouble fixing this problem I've been having.
As the title says, my commands mostly use parameters. Mostly player parameters.
However only certain ID's can make these commands work, ID 0 and 1, after selecting 2 and above..it doesn't work and returns as ID 0.
As the title says, my commands mostly use parameters. Mostly player parameters.
However only certain ID's can make these commands work, ID 0 and 1, after selecting 2 and above..it doesn't work and returns as ID 0.
pawn Код:
YCMD:jail(playerid, params[], help)
{
if( help ) return SendClientMessage( playerid, -1, "SERVER: Jail a player" );
if( PlayerInfo[playerid][pAdmin] >= 1 )
{
new
TargetID,
tReason[50];
if( !sscanf(params, "uS(No reason specified)[50]", TargetID, tReason) )
{
if( strlen( tReason) > 50 ) return SendClientMessage( playerid, -1, "SERVER: Maximum reason size: 50" );
if( !IsPlayerConnected(TargetID)) return SendClientMessage( playerid, -1, "SERVER: Invalid playerid! Please try again" );
new
MyString[128],
TargetString[128],
Float:Pos[3];
PlayerInfo[TargetID][pJailed] = true;
GetPlayerPos( TargetID, Pos[0], Pos[1], Pos[2] );
new rand = random(sizeof(JailCellSpawns));
SetPlayerPos(TargetID, JailCellSpawns[rand][0], JailCellSpawns[rand][1], JailCellSpawns[rand][2]);
format( MyString, sizeof MyString, "SERVER: Jailed %s (ID: %i). Reason: %s", GetName(TargetID), TargetID, tReason );
format( TargetString, sizeof TargetString, "SERVER: %s (ID: %i) was jailed by %s (ID: %i). Reason: %s", GetName(TargetID), TargetID, GetName(playerid), playerid, tReason );
SendClientMessage( playerid, -1, MyString );
SendClientMessageToAll( -1, TargetString );
}
else
return SendClientMessage( playerid, -1, "SERVER: /jail <TargetID> <Reason>" );
}
else
return SendClientMessage( playerid, -1, "SERVER: You have to be an admin to perform this command!" );
return 1;
}
pawn Код:
stock GetName(playerid)
{
new
pName[24];
GetPlayerName( playerid, pName, sizeof pName );
return pName;
}