How to make this thing more advanced..
#1

Код:
COMMAND:suspect(playerid, params[]) 
{
    new otherplayerid;
    if(sscanf(params, "u", otherplayerid)) return SendClientMessage(playerid, COLOR_RED, "Use /hi [playerid/name]");
    else if(!IsPlayerConnected(otherplayerid)) return SendClientMessage(playerid, COLOR_RED, "This player is not connected");
    else
    {
        SendClientMessage(otherplayerid,COLOR_RED,"You are now wanted!");
        SetPlayerWantedLevel(otherplayerid,2);
    }
    return 1;
}
How can I add more "if" 's to the it? I add some, but they don't work, they compile but they don't work... I wan't to add a if ( if(GetPlayerColor(playerid) == COLOR_BLUE || GetPlayerColor(otherplayerid) == COLOR_WHITE) and I want it to return something like... SetPlayerWantedLevel(otherplayerid,2);
Reply
#2

You mean this?

pawn Код:
if(GetPlayerColor(playerid) == COLOR_BLUE || GetPlayerColor(otherplayerid) == COLOR_WHITE) return SetPlayerWantedLevel(otherplayerid,2);
Reply
#3

Код:
COMMAND:suspect(playerid, params[])
{
    new otherplayerid;
    if(sscanf(params, "u", otherplayerid)) return SendClientMessage(playerid, COLOR_RED, "Use /hi [playerid/name]");
    else if(!IsPlayerConnected(otherplayerid)) return SendClientMessage(playerid, COLOR_RED, "This player is not connected");
    else if(!GetPlayerColor(playerid) == COLOR_BLUE) return SendClientMessage(playerid, COLOR_RED, "Only Police officers can use this command!");
    else if(!GetPlayerColor(otherplayerid) == COLOR_WHITE) return SendClientMessage(playerid, COLOR_RED, "This player can't be wanted!");
    else if(GetPlayerColor(playerid) == COLOR_BLUE || GetPlayerColor(otherplayerid) == COLOR_WHITE) return SetPlayerWantedLevel(otherplayerid,2) || SendClientMessage(playerid,COLOR_BLUE,"That player is now wanted!");
    {
        SendClientMessage(otherplayerid,COLOR_RED,"You are now wanted!");
        SendClientMessage(playerid,COLOR_BLUE,"That player is now wanted!");
        SetPlayerWantedLevel(otherplayerid,1);
		SetPlayerColor(otherplayerid,COLOR_ORANGE);
    }
    return 1;
}
Something like that, but it isn't working, it just sets the wanted level, nothing else....
Reply
#4

pawn Код:
else if(GetPlayerColor(playerid) != COLOR_BLUE) return SendClientMessage(playerid, COLOR_RED, "Only Police officers can use this command!");
    else if(GetPlayerColor(otherplayerid) != COLOR_WHITE) return SendClientMessage(playerid, COLOR_RED, "This player can't be wanted!");
    else
    {
        SendClientMessage(otherplayerid,COLOR_RED,"You are now wanted!");
        SendClientMessage(playerid,COLOR_BLUE,"That player is now wanted!");
        SetPlayerWantedLevel(otherplayerid,1);
        SetPlayerColor(otherplayerid,COLOR_ORANGE);
    }
Reply
#5

Thanks! <3
Reply
#6

Why the fuck did you just put a "<3" after your post..from MadeMan?
*looks slightly grossed out and confused..*
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)