Ticket Problem
#1

hi i tried to make if the id have wanted level, the police can give a ticket for the id (wanted player).. when police give a ticket to id (wanted player) the id money is lose $10.000

this is my code
Код:
CMD:ticket(playerid, params[])
{
	new id, reason, str[120], x,y,z;
	if(pInfo[playerid][pFaction] == 1)
	{
	    if(Duty[playerid] == 1)
	    {
            if(sscanf(params, "us[128]", id, reason)) return SendClientMessage(playerid, COLOR_WHITE, "** /ticket [playerid] [reasonn]");
       	    if(id == playerid) return SendClientMessage(playerid, -1, "** you can't give ticket for yourself");
			if(id == INVALID_PLAYER_ID) return SendClientMessage(playerid, -1, "** that player is not connected");
        	if(pInfo[playerid][pFacrank] < pInfo[id][pFacrank]) return SendClientMessage(playerid, -1, "** you can't give ticket for high rank");
  			if(!IsPlayerInRangeOfPoint(playerid, 5.0, x, y, z) && GetPlayerInterior(playerid) == GetPlayerInterior(id) && GetPlayerVirtualWorld(playerid) == GetPlayerVirtualWorld(id)) return SendClientMessage(playerid, -1, "** you must near the wanted player");
    		if(GetPlayerWantedLevel(id) == 0) return SendClientMessage(playerid, -1, "** that player have no wanted level");
		    GivePlayerMoney(id, -10000);
		    SetPlayerWantedLevel(id, 0);
			format(str, sizeof(str), "[POLICE]: {FFFFFF}Players %s telah ditilang oleh pak polisi %s karena %s", id, GetName(playerid), reason);
			SendClientMessageToAll(COLOR_BLUE, str);
			SendClientMessage(id, -1, "** Kau telah ditilang dan harus membayar sebesar {FF0000}$10.000");
			format(str, sizeof(str), "[POLICE]: Kau telah menilang %s dan mendapatkan uang sebesar {00FF00}$1000 {FFFFFF}dan 1 score point", id);
			SendClientMessage(playerid, -1, str);
			GivePlayerMoney(playerid, 1000);
			SetPlayerScore(playerid, GetPlayerScore(playerid)+1);
		}
		else return SendClientMessage(playerid, -1, "** you must ON Duty");
	}
	else return SendClientMessage(playerid, -1, "** you are not police");
	return 1;
}
but the code when i type "/ticket 1 killing" it say "** you can't give ticket to yourself " can someone fix this plz
Reply
#2

please help
Reply
#3

Try this ,
Код:
CMD:ticket(playerid, params[])
{
	new id, reason, str[120], x,y,z;
	if(pInfo[playerid][pFaction] == 1)
	{
	    if(Duty[playerid] == 1)
	    {
            if(sscanf(params, "us[128]", id, reason)) return SendClientMessage(playerid, COLOR_WHITE, "** /ticket [playerid] [reasonn]");
       	    else if(id == playerid) return SendClientMessage(playerid, -1, "** you can't give ticket for yourself");
			else if(id == INVALID_PLAYER_ID) return SendClientMessage(playerid, -1, "** that player is not connected");
        	else if(pInfo[playerid][pFacrank] < pInfo[id][pFacrank]) return SendClientMessage(playerid, -1, "** you can't give ticket for high rank");
  			else if(!IsPlayerInRangeOfPoint(playerid, 5.0, x, y, z) && GetPlayerInterior(playerid) == GetPlayerInterior(id) && GetPlayerVirtualWorld(playerid) == GetPlayerVirtualWorld(id)) return SendClientMessage(playerid, -1, "** you must near the wanted player");
    		else if(GetPlayerWantedLevel(id) == 0) return SendClientMessage(playerid, -1, "** that player have no wanted level");
			else if(GetPlayerWantedLevel(id) > 1)
			{
				GivePlayerMoney(id, -10000);
			    SetPlayerWantedLevel(id, 0);
				format(str, sizeof(str), "[POLICE]: {FFFFFF}Players %s telah ditilang oleh pak polisi %s karena %s", id, GetName(playerid), reason);
				SendClientMessageToAll(COLOR_BLUE, str);
				SendClientMessage(id, -1, "** Kau telah ditilang dan harus membayar sebesar {FF0000}$10.000");
				format(str, sizeof(str), "[POLICE]: Kau telah menilang %s dan mendapatkan uang sebesar {00FF00}$1000 {FFFFFF}dan 1 score point", id);
				SendClientMessage(playerid, -1, str);
				GivePlayerMoney(playerid, 1000);
				SetPlayerScore(playerid, GetPlayerScore(playerid)+= 1);
			}
		}
		else return SendClientMessage(playerid, -1, "** you must ON Duty");
	}
	else return SendClientMessage(playerid, -1, "** you are not police");
	return 1;
}
and can you show me the Duty codes?
Reply
#4

BTW It fixes by my self thx for helping
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)