Need Help with Return
#1

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
Reply
#2

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);
                    }
                }
Reply
#3

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);
                }
Reply
#4

thanks, it worked, you can close the thread now
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)