CMD:arrest(playerid, params[]) { new string1[200], string2[200], string3[200], CopName[24], CriminalName[24], CriminalID; if(gTeam[playerid] != POL && gTeam[playerid] != SECSRV && gTeam[playerid] != ARMY && gTeam[playerid] != SWAT) return SendClientMessage(playerid, COLOR_RED, "You are not a Law Enforcement Officer!"); if(sscanf(params, "u", CriminalID)) return SendClientMessage(playerid, COLOR_RED, "USAGE: /arrest [ID]"); if(CriminalID == playerid) return SendClientMessage(playerid, COLOR_RED, "You cannot arrest yourself, how is that possible?!"); if(GetDistanceBetweenPlayers(playerid, CriminalID) > 5) { if(GetPlayerWantedLevel(CriminalID) >= 3) { SetTimerEx("UnjailTimer", 120000, false, "i", CriminalID); isJailed[playerid] = 1; GetPlayerName(playerid, CopName, 24); GetPlayerName(CriminalID, CriminalName, 24); format(string1, 200, "Police Officer %s has arrested %s!", CopName, CriminalName); format(string2, 200, "You have been arrested by Police Officer %s!", CopName); format(string3, 200, "Good job, Officer! You have arrested %s!", CriminalName); SendClientMessageToAll(COLOR_YELLOW, string1); SendClientMessage(CriminalID, COLOR_ORANGE, string2); SendClientMessage(playerid, COLOR_GREEN, string3); SendClientMessage(playerid, COLOR_GREEN, "You have earned +3 score and $5000"); SetPlayerPos(CriminalID, 197.6661,173.8179,1003.0234); SetPlayerInterior(CriminalID, 3); SetPlayerScore(playerid, GetPlayerScore(playerid)+3); GivePlayerMoney(playerid, 5000); } else { SendClientMessage(playerid, COLOR_RED, "That player is not wanted!"); } } return 1; }
CMD:rape(playerid, params[]) { new string[128], string2[128], string3[128], RapistName[24], VictimName[24], targetid; if(gTeam[playerid] == POL || gTeam[playerid] == SECSRV || gTeam[playerid] == ARMY || gTeam[playerid] == SWAT) return SendClientMessage(playerid, COLOR_RED, "You are a Law Enforcement Officer, you cannot rape someone!"); if(sscanf(params, "u", targetid)) return SendClientMessage(playerid, COLOR_RED, "USAGE: /rape [ID]"); { if(GetDistanceBetweenPlayers(playerid, targetid) < 5) { if(!IsPlayerConnected(targetid)) return SendClientMessage(playerid, COLOR_RED, "That player is not connected."); if(targetid == playerid) return SendClientMessage(playerid, COLOR_RED, "You cannot rape yourself!"); GetPlayerName(playerid, RapistName, 24); GetPlayerName(targetid, VictimName, 24); new rand = random(sizeof(DiseaseNames)); pInfo[playerid][Diseases] = rand; switch(rand) { case 0: SendClientMessage(playerid, COLOR_GREY, "You are lucky this time, you didn't get any STDs!"); case 1: SendClientMessage(playerid, COLOR_GREY, "You received an HIV. Go to the hospital, quickly to get it cured."); case 2: SendClientMessage(playerid, COLOR_GREY, "You received Syphilis. Go to the hospital, quickly to get it cured."); case 3: SendClientMessage(playerid, COLOR_GREY, "You received the Crazy Chicken Flu. Go to the hospital, quickly to get it cured."); case 4: SendClientMessage(playerid, COLOR_GREY, "You received Mad Cow Disease. Go to the hospital, quickly to get it cured."); } format(string, 128, "You raped %s and gave him %s!", VictimName, DiseaseNames[rand]); format(string2, 128, "%s has raped you and given you %s!",RapistName, DiseaseNames[rand]); format(string3, 128, "%s has raped %s and infected him with %s!", RapistName, VictimName, DiseaseNames[rand]); SendClientMessage(playerid, COLOR_PINK, string); SendClientMessage(targetid, COLOR_ORANGE, string2); SendClientMessageToAll(COLOR_YELLOW, string3); } } return 1; }
if(GetPlayerWantedLevel(CriminalID) >= 3)
pInfo[playerid][Diseases] = rand;
// No, this: ->
pInfo[targetid][Diseases] = rand;
// and not:
switch(rand)
{
case 0: SendClientMessage(playerid, COLOR_GREY, "You are lucky this time, you didn't get any STDs!");
case 1: SendClientMessage(playerid, COLOR_GREY, "You received an HIV. Go to the hospital, quickly to get it cured.");
case 2: SendClientMessage(playerid, COLOR_GREY, "You received Syphilis. Go to the hospital, quickly to get it cured.");
case 3: SendClientMessage(playerid, COLOR_GREY, "You received the Crazy Chicken Flu. Go to the hospital, quickly to get it cured.");
case 4: SendClientMessage(playerid, COLOR_GREY, "You received Mad Cow Disease. Go to the hospital, quickly to get it cured.");
}
// but this:
switch(rand)
{
case 0: SendClientMessage(targetid, COLOR_GREY, "You are lucky this time, you didn't get any STDs!");
case 1: SendClientMessage(targetid, COLOR_GREY, "You received an HIV. Go to the hospital, quickly to get it cured.");
case 2: SendClientMessage(targetid, COLOR_GREY, "You received Syphilis. Go to the hospital, quickly to get it cured.");
case 3: SendClientMessage(targetid, COLOR_GREY, "You received the Crazy Chicken Flu. Go to the hospital, quickly to get it cured.");
case 4: SendClientMessage(targetid, COLOR_GREY, "You received Mad Cow Disease. Go to the hospital, quickly to get it cured.");
}
C:\Users\X\Desktop\X\gamemodes\X.pwn(1019) : warning 219: local variable "WantedLevel" shadows a variable at a preceding level C:\Users\X\Desktop\X\gamemodes\X.pwn(1020) : error 022: must be lvalue (non-constant) C:\Users\X\Desktop\X\gamemodes\X.pwn(1021) : warning 213: tag mismatch C:\Users\X\Desktop\X\gamemodes\X.pwn(1021) : warning 205: redundant code: constant expression is zero C:\Users\X\Desktop\X\gamemodes\X.pwn(1019) : warning 203: symbol is never used: "WantedLevel" Pawn compiler 3.2.3664 Copyright © 1997-2006, ITB CompuPhase
1019: new WantedLevel; 1020: WantedLevel = GetPlayerWantedLevel(CriminalID); 1021: if(!WantedLevel >= 3) return SendClientMessage(playerid, COLOR_RED, "That player does not have a Wanted Level above 3.");
new WantedLvl;
WantedLvl = GetPlayerWantedLevel(CriminalID);
if(WantedLvl < 3) return SendClientMessage(playerid, COLOR_RED, "That player does not have a Wanted Level above or equal 3.");
Try this:
pawn Код:
|
if(GetPlayerWantedLevel(CriminalID >= 1 && GetPlayerWantedLevel(CriminalID) <= 6)