Need Help with Return - 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: Need Help with Return (
/showthread.php?tid=461494)
Need Help with Return -
tommzy09 - 02.09.2013
hey guys, i'm having trouble with my scripting, i'm trying to return more than one thing but i currently can't
this is my code
Код:
case 0:
{
if(GetPlayerMoney(playerid) < 1000) return SendClientMessage(playerid, 0xFFFFFF, "You don't have enough cash for the Skydive.");
if(GetPlayerMoney(playerid) < 1000) return SetPlayerPos(playerid,1675.6082,-2324.6172,20.5469);
if(GetPlayerMoney(playerid) < 1000) return SetPlayerInterior(playerid,0);
GivePlayerMoney(playerid, -1000);
SetPlayerPos(playerid,0,0,1000);
SetPlayerInterior(playerid,0);
GivePlayerWeapon(playerid, 46, 1);
}
as you can see, when i don't have enough cash for the skydive, i want the player to be returned to this location, with his interior set to 0 and also showing the text saying the player doesn't have enough money for the sky dive
my problem is that this doesn't set the players position or interior, it only says the player doesn't have enough money
can someone help me out?
i want to return all 3 things but i don't know how to, i checked samp wiki and couldn't find out how to do it
Re: Need Help with Return -
xganyx - 02.09.2013
pawn Код:
case 0: // The third item listed
{
if(GetPlayerMoney(playerid) < 1000) return SendClientMessage(playerid, 0xFFFFFF, "You don't have enough cash for the Skydive.");
else
{
GivePlayerMoney(playerid, -1000);
SetPlayerPos(playerid,0,0,1000);
SetPlayerInterior(playerid,0);
GivePlayerWeapon(playerid, 46, 1);
}
}
Re: Need Help with Return -
Borg - 02.09.2013
You can return only 1 var, but can do more actions. Solution is
pawn Код:
case 0:
{
if(GetPlayerMoney(playerid) < 1000)
{
SendClientMessage(playerid, 0xFFFFFF, "You don't have enough cash for the Skydive.");
SetPlayerPos(playerid,1675.6082,-2324.6172,20.5469);
SetPlayerInterior(playerid,0);
return 0;
}
GivePlayerMoney(playerid, -1000);
SetPlayerPos(playerid,0,0,1000);
SetPlayerInterior(playerid,0);
GivePlayerWeapon(playerid, 46, 1);
}
Re: Need Help with Return -
tommzy09 - 02.09.2013
thanks, it worked, you can close the thread now