SA-MP Forums Archive
How to make this thing more advanced.. - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+---- Forum: Help Archive (https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: How to make this thing more advanced.. (/showthread.php?tid=252184)



How to make this thing more advanced.. - [JnA]DukeNukem - 30.04.2011

Код:
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);


Re: How to make this thing more advanced.. - MadeMan - 30.04.2011

You mean this?

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



Re: How to make this thing more advanced.. - [JnA]DukeNukem - 30.04.2011

Код:
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....


Re: How to make this thing more advanced.. - MadeMan - 30.04.2011

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);
    }



Re: How to make this thing more advanced.. - [JnA]DukeNukem - 30.04.2011

Thanks! <3


Re: How to make this thing more advanced.. - Steven82 - 30.04.2011

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