SA-MP Forums Archive
What's wrong with this code - 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: What's wrong with this code (/showthread.php?tid=508215)



What's wrong with this code - ChuckyBabe - 21.04.2014

The title says,
what's the wrong with this code, let me explain, ok i /setdonator myself and after i go to the VIP Car and i type /vipcar exit then after i goto the TP place it sets me to None Donator Level, the /vip exit too,, Here's the code

pawn Код:
CMD:vipcar(playerid, params[])
{
    if(IsPlayerInRangeOfPoint(playerid, 13.0, -4428.9282, 905.3157, 987.0435))
 {
  if(PlayerInfo[playerid][pDonator] >= 0)
  {
            if(isnull(params))
            {
                SendClientMessageEx(playerid, COLOR_WHITE, "USAGE: /vipcar [location]");
                SendClientMessageEx(playerid, COLOR_GRAD1, "Locations: EXIT");
                return 1;
            }

            if(strcmp(params,"EXIT",true) == 0)
            {
                if (GetPlayerState(playerid) == 2)
                {
                    new tmpcar = GetPlayerVehicleID(playerid);
                    SetVehiclePos(tmpcar, 1421.5347,-1677.0745,13.5469);
                    TelePos[playerid][0] = 0.0;TelePos[playerid][1] = 0.0;
                    SendClientMessageEx(playerid, COLOR_YELLOW, "VIP: You have been tp'ed with your VIP Car!");
                    SetPlayerInterior(playerid,0);
                    PlayerInfo[playerid][pInt] = 0;
                    SetPlayerVirtualWorld(playerid, 0);
                    PlayerInfo[playerid][pVW] = 0;
                    PlayerInfo[playerid][pDonator] = 255;
                }
                else
                {
                    SendClientMessageEx(playerid, COLOR_GRAD1, "   You are not in a vehicle!");
                }
            }
            }
    }
    return 1;
}
/vip exit

pawn Код:
CMD:vip(playerid, params[])
{
    if(IsPlayerInRangeOfPoint(playerid, 13.0, -4428.9282, 905.3157, 987.0435))
 {
  if(PlayerInfo[playerid][pDonator] >= 0)
  {
            if(isnull(params))
            {
                SendClientMessageEx(playerid, COLOR_WHITE, "USAGE: /vip [location]");
                SendClientMessageEx(playerid, COLOR_GRAD1, "Locations: EXIT");
                return 1;
            }

            if(strcmp(params,"EXIT",true) == 0)
            {
                    SetPlayerPos(playerid, 1421.5347,-1677.0745,13.5469);
                    TelePos[playerid][0] = 0.0;TelePos[playerid][1] = 0.0;
                    SendClientMessageEx(playerid, COLOR_YELLOW, "VIP: You have been tp'ed!");
                    SetPlayerInterior(playerid,0);
                    PlayerInfo[playerid][pInt] = 0;
                    SetPlayerVirtualWorld(playerid, 0);
                    PlayerInfo[playerid][pVW] = 0;
                    PlayerInfo[playerid][pDonator] = 255;
                }
            }
    }
    return 1;
}
Please help me i need this very fast !


Re: What's wrong with this code - Flake. - 21.04.2014

Shouldn't you be running a check to see if they are VIP to use the command?
pawn Код:
if(PlayerInfo[playerid][pDonator] >= 0)
All you're doing there is checking if their VIP level is or is equal to 0.

And why are you making pDonor a value of 255 here?
pawn Код:
PlayerInfo[playerid][pDonator] = 255;



Re: What's wrong with this code - ChuckyBabe - 21.04.2014

Quote:
Originally Posted by (*|Flake|*)
Посмотреть сообщение
Shouldn't you be running a check to see if they are VIP to use the command?
pawn Код:
if(PlayerInfo[playerid][pDonator] >= 0)
All you're doing there is checking if their VIP level is or is equal to 0.

And why are you making pDonor a value of 255 here?
pawn Код:
PlayerInfo[playerid][pDonator] = 255;
Then how to fix it ?


Re: What's wrong with this code - AchievementMaster360 - 21.04.2014

I noticed
pawn Код:
PlayerInfo[playerid][pDonator] = 255;
In both commands which I'm sure is your problem since it sets donatir level to 255 which could be the default amount. So remove that.


Re: What's wrong with this code - ChuckyBabe - 21.04.2014

Quote:
Originally Posted by AchievementMaster360
Посмотреть сообщение
I noticed
pawn Код:
PlayerInfo[playerid][pDonator] = 255;
In both commands which I'm sure is your problem since it sets donatir level to 255 which could be the default amount. So remove that.
Thanks +rep