SA-MP Forums Archive
Pay'n Spray 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)
+--- Thread: Pay'n Spray Help (/showthread.php?tid=549024)



Pay'n Spray Help - Airblog - 04.12.2014

Hello everyone!
i'm making a pay'n spray biz
i just want a timer when player typed /spray he/she get into the spray and after 9 second he/she get out of spray
Код:
CMD:spray(playerid,vehicleid, params[])
{
    if(!IsPlayerLoggedIn(playerid)) return SendClientMessage(playerid, COLOR_GREY, "Aval Bayad login Koni Ghabl Az inke Az CMD Ha Estefade Koni.");
   	if(!IsPlayerInRangeOfPoint(playerid,7 ,1025.7101,-1031.9343,31.6613)) return SendClientMessage(playerid, COLOR_GREY, "Shoma Kenare Spray Nistid.");
    GiveZaiatMoney(playerid,-15);
	if(IsPlayerInAnyVehicle(playerid))
{
    if(GetPlayerState(playerid) == PLAYER_STATE_DRIVER)
    {
        SetVehiclePos(GetPlayerVehicleID(playerid), 1024.9365,-1024.1611,32.1016);
    }

    else
    {
        SendClientMessage(playerid, COLOR_RED, "ERROR: You need to be the driver!");
    }
}
    else
{

    SetPlayerPos(playerid,1024.8822,-1031.2749,31.9920);
    }
	
	
    return 1;
}
i don't know how to use this:
Код:
SetTimer("Spray",9000,0);
Sry for bad english Plz Help For +rep


Re: Pay'n Spray Help - Write - 04.12.2014

pawn Код:
CMD:spray(playerid,vehicleid, params[])
{
    if(!IsPlayerLoggedIn(playerid)) return SendClientMessage(playerid, COLOR_GREY, "Aval Bayad login Koni Ghabl Az inke Az CMD Ha Estefade Koni.");
    if(!IsPlayerInRangeOfPoint(playerid,7 ,1025.7101,-1031.9343,31.6613)) return SendClientMessage(playerid, COLOR_GREY, "Shoma Kenare Spray Nistid.");
    GiveZaiatMoney(playerid,-15);
    if(IsPlayerInAnyVehicle(playerid))
{
    if(GetPlayerState(playerid) == PLAYER_STATE_DRIVER)
    {
        SetVehiclePos(GetPlayerVehicleID(playerid), 1024.9365,-1024.1611,32.1016);
        SetTimerEx("Spray", 9000, false, "i", playerid);
    }

    else
    {
        SendClientMessage(playerid, COLOR_RED, "ERROR: You need to be the driver!");
    }
}
    else
{

    SetPlayerPos(playerid,1024.8822,-1031.2749,31.9920);
    }
   
   
    return 1;
}


forward Spray(playerid);
 
public Spray(playerid)
{
    SetVehiclePos(GetPlayerVehicleID(playerid), coordx, coordy, coordz); // replace with where you want him to be teleported with the car.
    return 1;
}



Re: Pay'n Spray Help - M4D - 04.12.2014

hi !
you have to use SetTimerEx because SetTimer is global and you can't call function with playerid or other parametrs.

i have edited your command a bit
just fix positions !

pawn Код:
CMD:spray(playerid,vehicleid, params[])
{
    if(!IsPlayerLoggedIn(playerid)) return SendClientMessage(playerid, COLOR_GREY, "Aval Bayad login Koni Ghabl Az inke Az CMD Ha Estefade Koni.");
    if(!IsPlayerInRangeOfPoint(playerid,7 ,1025.7101,-1031.9343,31.6613)) return SendClientMessage(playerid, COLOR_GREY, "Shoma Kenare Spray Nistid.");
    GiveZaiatMoney(playerid,-15);
    if(IsPlayerInAnyVehicle(playerid))
    {
      if(GetPlayerState(playerid) == PLAYER_STATE_DRIVER)
      {
        SetVehiclePos(GetPlayerVehicleID(playerid), 1024.9365,-1024.1611,32.1016); //>In PayPay'n Spray Pos
        SetTimerEx("PaynSpray", 9000, false, "i", playerid);
      }
      else
      {
        SendClientMessage(playerid, COLOR_RED, "ERROR: You need to be the driver!");
      }
    }
    return 1;
}

forward PaynSpray(playerid);
public PaynSpray(playerid)
{
 SetVehiclePos(GetPlayerVehicleID(playerid), 1024.9365,-1024.1611,32.1016); //>Out of the PayPay'n Spray Position
 return 1;
}
Good luck
(Movafagh Bashi )

EDIT: @Turn you was faster Sry i was writing and i didn't check topic that someone replied or no


Re: Pay'n Spray Help - Airblog - 04.12.2014

Tnx Both of you :X
Rep 4 both of you
Tnx