24.03.2009, 22:40
So , i am making a /fine command... and i want to do it as the simple way i can ... i made this code from my head :
pawn Код:
if(strcmp, cmdtext, "/fine", true) == 0) {
tmp = strtok(cmdtext, idx);
if(!strlen(tmp)) {
SendClientMessage(playerid, COLOR_ERROR, "[SERVER] USAGE: /fine [Playerid]");
return 1;
}
if(gTeam[playerid] != COPS ) {
SendClientMessage(playerid,COLOR_ERROR,"[SERVER] You are not a cop");
return 1;
}
if(Wanted[giveplayerid] != 1) {
SendClientMessage(playerid,COLOR_ERROR,"[SERVER] This Player isn't Wanted!");
return 1;
}
giveplayerid = strval(tmp);
if(!IsPlayerConnected(giveplayerid)) {
format(string, sizeof(string), "[SERVER] ID (%d) is not an active player", giveplayerid);
SendClientMessage(playerid, COLOR_ERROR, string);
return 1;
}
if(GetDistanceBetweenPlayers(playerid,giveplayerid) > 8) {
SendClientMessage(playerid,COLOR_ERROR, "[SERVER] You are not close enough");
return 1;
}
if(GetPlayerWantedLevel(giveplayerid) == 3) {
format(string, sizeof(string), "[SERVER] Officer %s(%d) has fined you $2000. Your wanted level has been reduced ",oname,playerid);
SendClientMessage(giveplayerid,YELLOW, string);
format(string, sizeof(string), "~w~You have been fined~n~ ~b~$500");
GameTextForPlayer(giveplayerid, string,5000, 0);
Wanted[giveplayerid] == 0
GivePlayerMoney(giveplayerid, -500);
format(string, sizeof(string), "[SERVER] You have issued a fine to %s(%d) and you receive a collection bonus of $500",pname,giveplayerid);
SendClientMessage(playerid,COLOR_YELLOW, string);
GivePlayerMoney(playerid, 500);
return 1;
}
}