SA-MP Forums Archive
need help - 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: need help (/showthread.php?tid=118549)



need help - rs2fun111 - 03.01.2010

Can Someone help To Correct This Code?

i tryd to make andromanda enter with score but it not gives a function .
Код:
public OnPlayerStateChange(playerid, newstate, oldstate){
if(newstate==PLAYER_STATE_DRIVER)
{
if(GetVehicleModel(GetPlayerVehicleID(playerid)) == 592, GetPlayerScore(playerid) >= 500)
{
SendClientMessage(playerid, COLOR_YELLOW,"Welcome To Andromanda!");
}
else
{
SendClientMessage(playerid, COLOR_YELLOW,"You Need Atleast 500 Score To Enter Andromanda!");
new string[128];
format(string, sizeof(string), "Your Flight Score is: %i",GetPlayerScore(playerid));
SendClientMessage(playerid, COLOR_YELLOW, string);
}
}
return 1;
}



Re: need help - Backwardsman97 - 03.01.2010

pawn Код:
public OnPlayerStateChange(playerid, newstate, oldstate)
{
    if(newstate==PLAYER_STATE_DRIVER)
    {
        if((GetVehicleModel(GetPlayerVehicleID(playerid)) == 592) && (GetPlayerScore(playerid) >= 500))
        {
            SendClientMessage(playerid, COLOR_YELLOW,"Welcome To Andromanda!");
            return 1;
        }
        else
        {
            SendClientMessage(playerid, COLOR_YELLOW,"You Need Atleast 500 Score To Enter Andromanda!");

            new string[128];
            format(string, sizeof(string), "Your Flight Score is: %i",GetPlayerScore(playerid));
            SendClientMessage(playerid, COLOR_YELLOW, string);
            return 1;
        }
    }
    return 1;
}
Try that. You had it like this.
pawn Код:
if(GetVehicleModel(GetPlayerVehicleID(playerid)) == 592, GetPlayerScore(playerid) >= 500)
It needs to be like this.
pawn Код:
if((GetVehicleModel(GetPlayerVehicleID(playerid)) == 592) && (GetPlayerScore(playerid) >= 500))
You don't have to have those extra parenthesis but it makes it easier to read.


Re: need help - rs2fun111 - 03.01.2010

yeh thanks

i have to add this too

Код:
RemovePlayerFromVehicle(playerid);



Re: need help - rs2fun111 - 03.01.2010

but if i try to enter hydra then it says same like andromanda and removes me .


Re: need help - Backwardsman97 - 03.01.2010

Use this.

pawn Код:
public OnPlayerStateChange(playerid, newstate, oldstate)
{
    if(newstate==PLAYER_STATE_DRIVER)
    {
        if(GetVehicleModel(GetPlayerVehicleID(playerid)) == 592)
        {
            if(GetPlayerScore(playerid) >= 500)
            {
                SendClientMessage(playerid, COLOR_YELLOW,"Welcome To Andromanda!");
                return 1;
            }
            else
            {
                SendClientMessage(playerid, COLOR_YELLOW,"You Need Atleast 500 Score To Enter Andromanda!");

                new string[128];
                format(string, sizeof(string), "Your Flight Score is: %i",GetPlayerScore(playerid));
                SendClientMessage(playerid, COLOR_YELLOW, string);
                return 1;
            }
        }
    }
    return 1;
}