14.09.2012, 01:31
Two commands, one of them crashes the server, no compiling error, can't see why..
OR
http://pastebin.com/W0FXxtUy
If someone would like to test it with me..
http://mibbit.com/?channel=%23sacnc....irc.sa-irc.com
Anyone?
pawn Код:
dcmd_ticket(playerid,params[])
{
#pragma unused params
new pname[MAX_PLAYER_NAME];
new Spname[MAX_PLAYER_NAME];
new string[128];
new id;
if(sscanf(params, "u", id))
{
SendClientMessage(playerid,COLOR_ERROR,"Usage: /ticket /tk (Player Name/ID)");
return 1;
}
if(IsFrozen[playerid] == 1)
{
SendClientMessage(playerid,COLOR_RED,"You cannot use this command while frozen.");
return 1;
}
if(gTeam[playerid] != TEAM_COP && gTeam[playerid] != TEAM_ARMY && gTeam[playerid] != TEAM_CIA)
{
SendClientMessage(playerid,COLOR_RED,"Only law enforement officers could use this command.");
return 1;
}
if(!IsPlayerConnected(id))
{
SendClientMessage(playerid, COLOR_RED, "The player is not connected to the server");
return 1;
}
if(id == playerid)
{
SendClientMessage(playerid,COLOR_RED,"You cannot ticket yourself.");
return 1;
}
if(InAdminMode[id] == 1)
{
SendClientMessage(playerid,COLOR_RED,"You cannot use this command on this player because they are in Administration mode.");
return 1;
}
if(GetPlayerWantedLevel(id) == 0)
{
GetPlayerName(id,Spname,MAX_PLAYER_NAME);
format(string,sizeof(string),"%s(%d) is not wanted.",Spname,id);
SendClientMessage(playerid,COLOR_RED,string);
return 1;
}
if(GetPlayerWantedLevel(id) == 6)
{
GetPlayerName(id,Spname,MAX_PLAYER_NAME);
format(string,sizeof(string),"%s(%d)'s wanted level is arrest-able, use /ar (Player Name/ID).",Spname,id);
SendClientMessage(playerid,COLOR_RED,string);
return 1;
}
if(GetDistanceBetweenPlayers(playerid,id) > 14)
{
GetPlayerName(id,Spname,MAX_PLAYER_NAME);
format(string,sizeof(string),"%s(%d) is too far away to issue a ticket to.",Spname,id);
SendClientMessage(playerid,COLOR_RED,string);
return 1;
}
if(GetDistanceBetweenPlayers(playerid,id) <= 13)
{
if(GetPlayerWantedLevel(id) == 3)
{
GetPlayerName(playerid,pname,MAX_PLAYER_NAME);
GetPlayerName(id,Spname,MAX_PLAYER_NAME);
format(string,sizeof(string),"[LAW ENFORCEMENT RADIO] Law Enforcement Officer %s(%d) has issued a ticket to %s(%d).",pname,playerid,Spname,id);
SendCopMessage(COLOR_BLUE,string);
SendCIAMessage(COLOR_BLUE,string);
SendArmyMessage(COLOR_GREEN,string);
GetPlayerName(id,Spname,MAX_PLAYER_NAME);
format(string,sizeof(string),"You've issued a ticked to %s(%d), and awarded with $2000",Spname,id);
SendClientMessage(playerid,COLOR_BLUE,string);
IncreasePlayerScore(playerid,1);
GivePlayerMoney(playerid, 2000);
SetPlayerToTeamColour(id);
SetPlayerWantedLevel(id, 0);
SetPlayerColor(id, COLOR_WHITE);
GameTextForPlayer(id,"~y~TICKET RECIEVED",1000,4);
SendClientMessage(id,COLOR_YELLOW,"You've recieved a ticket by %s(%d), you've got 60 seconds to pay the ticket.");
HasTicket[id] =1;
TimeToPayTicket[id] =60;
return 1;
}
}
return 1;
}
dcmd_tk(playerid,params[]) return dcmd_ticket(playerid,params);
//=======================================================================================//
dcmd_payticket(playerid,params[])
{
#pragma unused params
new pname[MAX_PLAYER_NAME];
new string[128];
if(IsFrozen[playerid] == 1)
{
SendClientMessage(playerid,COLOR_RED,"You cannot use this command while frozen.");
return 1;
}
if(HasTicket[playerid] != 1)
{
SendClientMessage(playerid,COLOR_ERROR,"You do not have a ticket to pay.");
return 1;
}
SendClientMessage(playerid,COLOR_YELLOW,"You have paid your ticket of $2000 and your wanted level has been removed.");
SetPlayerWantedLevel(playerid,0);
GivePlayerMoney(playerid,-2000);
HasTicket[playerid] =0;
TimeToPayTicket[playerid] =0;
GetPlayerName(playerid,pname,MAX_PLAYER_NAME);
format(string,sizeof(string),"[LAW ENFORCEMENT RADIO] Suspect %s(%d) has paid their ticket.",pname,playerid);
SendCopMessage(COLOR_BLUE,string);
SendCIAMessage(COLOR_BLUE,string);
SendArmyMessage(COLOR_GREEN,string);
return 1;
}
dcmd_pt(playerid,params[]) return dcmd_payticket(playerid,params);
http://pastebin.com/W0FXxtUy
If someone would like to test it with me..
http://mibbit.com/?channel=%23sacnc....irc.sa-irc.com
Anyone?