help /jail command
#1

i can't choose the player id :S i don't know how to fix it.
Can some1 plz help me.

if (strcmp(cmdtext,"/jail",true)==0)
{
if(dUserINT(PlayerName(playerid)).("level") < 2){
SendClientMessage(playerid, COLOR_YELLOW,"You are not an admin.");
}else{
if(!strlen (tmp))
{
SendClientMessage (playerid , COLOR_WHITE , "USAGE: /jail [playerid]");
return 1;
}

new giveplayerid = strval(tmp);
tmp = strtok(cmdtext, idx);

if(!strlen(tmp))
{
if (IsPlayerConnected(giveplayerid))
{
SetPlayerInterior(playerid, 6);
SetPlayerPos(playerid,264.6288,77.5742,1001.0391);
SetCameraBehindPlayer(playerid);
format(string, sizeof(string), "%s has jailed by Admin %s.",GetName(playerid), GetName(giveplayerid));
SendClientMessageToAll(COLOR_WHITE, string);
printf(string);
return 1;
}else{
format(string, sizeof(string), "id %d is not an active player.", giveplayerid);
SendClientMessage(playerid, COLOR_WHITE, string);

}
}
}
return 1;
}
Reply
#2

Try this

Quote:

if(strcmp(cmd, "/jail", true) == 0)
{
if(IsPlayerConnected(playerid))
{
tmp = strtok(cmdtext, idx);
if(!strlen(tmp))
{
SendClientMessage(playerid, COLOR_GRAD2, "USAGE: /jail [playerid/PartOfName] [time(minutes)]");
return 1;
}
new playa;
new money;
playa = ReturnUser(tmp);
tmp = strtok(cmdtext, idx);
money = strval(tmp);
if (PlayerInfo[playerid][pAdmin] >= 2)
{
if(IsPlayerConnected(playa))
{
if(playa != INVALID_PLAYER_ID)
{
GetPlayerName(playa, giveplayer, sizeof(giveplayer));
GetPlayerName(playerid, sendername, sizeof(sendername));
format(string, sizeof(string), "* You Jailed %s.", giveplayer);
SendClientMessage(playerid, COLOR_LIGHTRED, string);
format(string, sizeof(string), "* You were Jailed by Admin %s.", sendername);
SendClientMessage(playa, COLOR_LIGHTRED, string);
ResetPlayerWeapons(playa);
WantedPoints[playa] = 0;
PlayerInfo[playa][pJailed] = 1;
PlayerInfo[playa][pJailTime] = money*60;
SetPlayerInterior(playa, 6);
SetPlayerPos(playa, 264.6288,77.5742,1001.0391);
format(string, sizeof(string), "You are jailed for %d minutes. Bail: Unable", money);
SendClientMessage(playa, COLOR_LIGHTBLUE, string);
}
}
}
else
{
SendClientMessage(playerid, COLOR_GRAD1, " you are not authorized to use that command!");
}
}
return 1;
}

Reply
#3

thank you very much
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)