Help..... -
jimis - 30.03.2012
I need someone who can create me an /ar id system for TEAM_LSPD ,TEAM_ARMY, TEAM_FBI ..
please someone
i will give a reputation
Thanks for reading
Re: Help..... -
The__ - 30.03.2012
What is /ar man?
Re: Help..... -
Harish - 30.03.2012
pawn Код:
public OnPlayerCommandText(playerid, cmdtext[])
{
new cmd[128], idx;
cmd = strtok(cmdtext, idx);
if(strcmp(cmd, "/ar", true) == 0)
{
new tmp[128];
tmp = strtok(cmdtext, idx);
if(strlen(tmp) == 0) return SendClientMessage(playerid, 0xFFFFFFFF, "USAGE: /ar [playerid]");
if(gTeam[playerid] == TEAM_OTHER){SendClientMessage(playerid,COLOR_RED,"Only cops can use this..");
else
{
SetPlayerInterior(idx,JailInt);/////////Here you can use your jail interior
SetPlayerPos(idx,JailX,jailY,jailZ);////Here you can use you jail pos
//and also you can add your features in jailing like timer ex to release
// and cops bonus by give cash to playerid and so on..
}
return 1;
}
return 0;
}
Re: Help..... -
jimis - 30.03.2012
/ar is arrest
thanks harrish, but if the player isnt near to cop and if the player isnt suspect?
Re: Help..... -
jimis - 30.03.2012
I have the following problems:
C:\Users\Дзмзфсзт\Desktop\jimis\gamemodes\newtest. pwn(2243) : error 017: undefined symbol "strtok"
C:\Users\Дзмзфсзт\Desktop\jimis\gamemodes\newtest. pwn(2243) : error 033: array must be indexed (variable "cmd")
C:\Users\Дзмзфсзт\Desktop\jimis\gamemodes\newtest. pwn(224

: error 017: undefined symbol "strtok"
C:\Users\Дзмзфсзт\Desktop\jimis\gamemodes\newtest. pwn(224

: error 033: array must be indexed (variable "tmp")
C:\Users\Дзмзфсзт\Desktop\jimis\gamemodes\newtest. pwn(2253) : error 029: invalid expression, assumed zero
Pawn compiler 3.2.3664 Copyright © 1997-2006, ITB CompuPhase
5 Errors.
Re: Help..... -
Mike_Peterson - 30.03.2012
add this to -> bottom of script
pawn Код:
strtok(const string[], &index)
{
new length = strlen(string);
while ((index < length) && (string[index] <= ' '))
{
index++;
}
new offset = index;
new result[20];
while ((index < length) && (string[index] > ' ') && ((index - offset) < (sizeof(result) - 1)))
{
result[index - offset] = string[index];
index++;
}
result[index - offset] = EOS;
return result;
}
Ur the fifth person this week that i had to send this function to.. lol
Re: Help..... -
jimis - 30.03.2012
ok thanks,but what that do?
Re: Help..... -
Harish - 31.03.2012
pawn Код:
public OnPlayerCommandText(playerid, cmdtext[])
{
new cmd[128], idx;
cmd = strtok(cmdtext, idx);
if(strcmp(cmd, "/ar", true) == 0)
{
new tmp[128];
tmp = strtok(cmdtext, idx);
if(strlen(tmp) == 0) return SendClientMessage(playerid, 0xFFFFFFFF, "USAGE: /ar [playerid]");
if(gTeam[playerid] == TEAM_OTHER){SendClientMessage(playerid,COLOR_RED,"Only cops can use this..");
else
{
new Float:coppos[3];
GetPlayerPos(playerid,coppos[0],coppos[1],coppos[2]);
if(IsPlayerInRangeOfPoint(idx,10.0,coppos[0],coppos[1],coppos[2]))///This will check the suspect is near or not//
{
new WantedLevel = GetplayerWantedLevel(idx);
if(WantedLevel !=0)///this will check the wanted level of the player and allow him to arrest when he have been suspected
{
SetPlayerInterior(idx,JailInt);/////////Here you can use your jail interior
SetPlayerPos(idx,JailX,jailY,jailZ);////Here you can use you jail pos
//and also you can add your features in jailing like timer ex to release
// and cops bonus by give cash to playerid and so on..
}
else{SendClientMessage(playerid,0XFFFFFF,"Suspect was an innocent");}
}
else{SendClientMessage(playerid,0xFFFFFF,"Arresting Player was not in Range");}
}
return 1;
}
return 0;
}
and strtok will get the text after space in command
Re: Help..... -
Harish - 03.04.2012
hi.. check your PM i had cleared all the errors and send it to your PM