20.07.2011, 10:54
How can I add to this script removing license please?
That can use only cops pMember = 1, pLeader = 1
That can use only cops pMember = 1, pLeader = 1
pawn Код:
public OnPlayerCommandText(playerid, cmdtext[])
{
new
cmd[256], tmp[256], string[128], idx,
o_name[MAX_PLAYER_NAME], p_name[MAX_PLAYER_NAME]
;
cmd = strtok(cmdtext, idx);
if(strcmp(cmd, "/dlicense", true) == 0)
{
tmp = strtok(cmdtext,idx);
if(!strlen(tmp)) return SendClientMessage(playerid, -1, "USAGE: /dlicense [ID]");
new id = strval(tmp);
if(id == INVALID_PLAYER_ID) return SendClientMessage(playerid, -1, "SERVER: playerid is not connected");
new Float:x[3];
GetPlayerPos(playerid,x[0],x[1],x[2]);
if(IsPlayerConnected(id))
if(IsPlayerInRangeOfPoint(id,4.0,x[0],x[1],x[2]))
{
GetPlayerName(id, o_name, sizeof(o_name));
GetPlayerName(playerid, p_name, sizeof(p_name));
format(string, sizeof(string), "CarLicenses/%s.ini", o_name);
if(!fexist(string)) {
format(string, sizeof(string), "%s Driving License : NOT PASSED.", p_name);
SendClientMessage(id, -1, string);
format(string, sizeof(string), " You have showed your license to %s.", o_name);
SendClientMessage(playerid, -1, string);
} else {
format(string, sizeof(string), "%s Driving License : PASSED.", p_name);
SendClientMessage(id, -1, string);
format(string, sizeof(string), "You have showed your license to %s.", o_name);
SendClientMessage(playerid, -1, string);
}
return 1;
}
else
{
SendClientMessage(playerid,0xFF0000FF,"This player is too far away!");
}
printf("LICENSE: [%d]%s showed [%d]%s his license.", playerid, p_name, id, o_name);
return 1;
}
return 0;
}
stock 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;
}