/jail command. Whats wrong here? -
Puzi - 25.08.2009
Hey there,
This command has no errors, but doesn't work at all. Can someone tell me whats wrong? I would appreciate it, since my pawno knowledge isnt very advanced.
Код:
if(strcmp(cmdtext, "/ajail", true) == 0)
{
if(IsPlayerAdmin(playerid))
{
SendClientMessage(playerid, COLOR_WHITE, "USAGE/UŻYCIE: /ajail [ID]");
{
if (IsPlayerConnected(giveplayerid))
{
SetPlayerInterior(playerid, 6);
SetPlayerPos(playerid,264.6288,77.5742,1001.0391);
SetCameraBehindPlayer(playerid);
new pname[MAX_PLAYER_NAME];
GetPlayerName(playerid, pname, sizeof (pname));
format(stringl, sizeof(stringl), "*** %s has been jailed by Admin / został uwięziony przez Admina: %s.", pname, pname);
SendClientMessageToAll(COLOR_ADMIN, stringl);
printf(stringl);
return 1;
}else{
format(stringl, sizeof(stringl), "ID %d is not an active player / nie jest aktywnym graczem!", giveplayerid);
SendClientMessage(playerid, COLOR_GREY, stringl);
}
}
}
return 1;
}
And is that unjail command correct too?
Код:
if(strcmp(cmdtext, "/aunjail", true) == 0)
{
if(IsPlayerAdmin(playerid))
{
SetPlayerInterior(playerid, 0);
SetPlayerPos(playerid,2139.2112,1000.7551,10.8203);
SendClientMessage(playerid,COLOR_GREEN, "*** You have been released from jail / Zostałes zwolniony z więzienia!");
}
return 1;
}
Thanks and Regards

Puzi
Re: /jail command. Whats wrong here? -
Kyle - 25.08.2009
You have no id system so giveplayerid = means nothing
Re: /jail command. Whats wrong here? -
Puzi - 26.08.2009
Ah well, how to make this id system?
Re: /jail command. Whats wrong here? -
Clavius - 26.08.2009
Use
strtok, or switch to
dcmd and sscanf, which is easier to use in my opinion.
Re: /jail command. Whats wrong here? -
Puzi - 26.08.2009
I have strtok in my script, and I dont think using dcmd or sscanf will help me, im dumb at pwn, sry
Re: /jail command. Whats wrong here? -
dice7 - 26.08.2009
Yes, you have it, but you need to use it
https://sampwiki.blast.hk/wiki/Strtok
Re: /jail command. Whats wrong here? -
Puzi - 26.08.2009
Код:
if(strcmp(cmd, "/ajail", true) == 0)
{
new tmp[128];
tmp = strtok(cmdtext, idx);
if(strlen(tmp) == 0) return SendClientMessage(playerid, 0xFFFFFFFF, "USAGE/UŻYCIE: /kick [playerid]");
Jail(strval(tmp));
return 1;
}
{
if (IsPlayerConnected(giveplayerid))
{
SetPlayerInterior(playerid, 6);
SetPlayerPos(playerid,264.6288,77.5742,1001.0391);
SetCameraBehindPlayer(playerid);
new pname[MAX_PLAYER_NAME];
GetPlayerName(playerid, pname, sizeof (pname));
format(stringl, sizeof(stringl), "*** %s has been jailed by Admin / został uwięziony przez Admina: %s.", pname, pname);
SendClientMessageToAll(COLOR_ADMIN, stringl);
printf(stringl);
return 1;
}else{
format(stringl, sizeof(stringl), "ID %d is not an active player / nie jest aktywnym graczem!", giveplayerid);
SendClientMessage(playerid, COLOR_GREY, stringl);
}
}
}
return 1;
}
Fuck, please help. I get load of errors
Re: /jail command. Whats wrong here? -
Jefff - 26.08.2009
pawn Код:
if(strcmp(cmdtext, "/ajail", true,6) == 0)
{
if(!strlen(cmdtext[7])) return SendClientMessage(playerid, COLOR_WHITE, "USAGE/UŻYCIE: /kick [playerid]");
if(IsPlayerConnected(strval(cmdtext[7])))
{
SetPlayerPos(strval(cmdtext[7]),264.6288,77.5742,1001.0391);
SetPlayerInterior(strval(cmdtext[7]), 6);
SetCameraBehindPlayer(strval(cmdtext[7]));
new pname[MAX_PLAYER_NAME];
GetPlayerName(strval(cmdtext[7]), pname, sizeof (pname));
format(stringl, sizeof(stringl), "*** %s has been jailed by Admin / został uwięziony przez Admina: %s.", pname,pname);
SendClientMessageToAll(COLOR_ADMIN, stringl);
printf(stringl);
}else{
format(stringl, sizeof(stringl), "ID %d is not an active player / nie jest aktywnym graczem!", strval(cmdtext[7]));
SendClientMessage(playerid, COLOR_GREY, stringl);
}
return 1;
}
Cheerz.
Re: /jail command. Whats wrong here? -
Puzi - 26.08.2009
When I compile, I get a crash
Re: /jail command. Whats wrong here? -
Jefff - 26.08.2009
It works fine for me.