SA-MP Forums Archive
how cand i do that - 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)
+--- Thread: how cand i do that (/showthread.php?tid=488872)



how cand i do that - crazyze - 19.01.2014

i have an script on my gm with stunt event , i want to participate onlye people that have NRG or PCJ .

This is the comand /stuntevent :

Код:
if(strcmp(cmd,"/stuntevent",true)==0)
    {
        if(IsPlayerConnected(playerid))
        {
		   if(NRGStarted == 0)
		   {
               SendClientMessage(playerid, COLOR_LIGHTBLUE,"This event isn't started at the moment!");
               return 1;
		   }
		   if(PlayerOnMission[playerid] > 0)
           {
                        SendClientMessage(playerid, COLOR_GREY, " You're on mission right now,you can't hold any Materials Packages!");
                        return 1;
           }
           SetPlayerCheckpoint(playerid, NRGStuntX,NRGStuntY,NRGStuntZ, 3.0);
           IsAtStuntEvent[playerid] = 1;
           SendClientMessage(playerid, COLOR_LIGHTBLUE, "{FFFFFF}••• Ai intrat la {FF9900}StuntEVENT. {FFFFFF}Du-te la checkpoint si fa {FF9900}stunt-ul!");
           return 1;
		}
	}



Re: how cand i do that - SickAttack - 19.01.2014

To check if the player is in a certain vehicle you can use this functions:
Код:
if(GetPlayerVehicleID(playerid) == 522) 
{
    // The player is in a NRG-500.
}
if(GetPlayerVehicleID(playerid) == 461) 
{
    // The player is in a PCJ-600.
}



Re: how cand i do that - crazyze - 19.01.2014

and how , or where i will add what u give me .. sry but im new in scripting ...


Re: how cand i do that - SickAttack - 19.01.2014

You can add it under if(PlayerOnMission[playerid] > 0).
Код:
if(GetPlayerVehicleID(playerid) == 522 || GetPlayerVehicleID(playerid) == 461) 
{
           SetPlayerCheckpoint(playerid, NRGStuntX,NRGStuntY,NRGStuntZ, 3.0);
           IsAtStuntEvent[playerid] = 1;
           SendClientMessage(playerid, COLOR_LIGHTBLUE, "{FFFFFF}••• Ai intrat la {FF9900}StuntEVENT. {FFFFFF}Du-te la checkpoint si fa {FF9900}stunt-ul!");
           return 1;
}
else
{
          SendClientMessage(playerid, COLOR_LIGHTBLUE, "{FFFFFF}••• You must be in a NRG-500 or PCJ-600");
}



Re: how cand i do that - Konstantinos - 19.01.2014

pawn Код:
if (!strcmp(cmd, "/stuntevent", true))
{
    if (!NRGStarted) return SendClientMessage(playerid, COLOR_LIGHTBLUE,"This event isn't started at the moment!");
    if (PlayerOnMission[playerid] > 0) return SendClientMessage(playerid, COLOR_GREY, " You're on mission right now,you can't hold any Materials Packages!");
   
    for (new i; i != MAX_PLAYERS; ++i)
    {
        if (!IsPlayerConnected(i)) continue;
        switch (GetVehicleModel(GetPlayerVehicleID(playerid)))
        {
            case 461, 522:
            {
                SetPlayerCheckpoint(i, NRGStuntX,NRGStuntY,NRGStuntZ, 3.0);
                IsAtStuntEvent[i] = 1;
                SendClientMessage(i, COLOR_LIGHTBLUE, "{FFFFFF}••• Ai intrat la {FF9900}StuntEVENT. {FFFFFF}Du-te la checkpoint si fa {FF9900}stunt-ul!");
            }
        }
    }
    return 1;
}