SA-MP Forums Archive
Help with 4 restrictions on 1 row , i give rep ++ - 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: Help with 4 restrictions on 1 row , i give rep ++ (/showthread.php?tid=551189)



Help with 4 restrictions on 1 row , i give rep ++ - buburuzu19 - 17.12.2014

So i have the next code , i want to restrict the users from starting their cars when they have a flat:
pawn Код:
if((newkeys == KEY_SUBMISSION)&&(IsPlayerInAnyVehicle(playerid))&&(GetPlayerState(playerid)==PLAYER_STATE_DRIVER))
    {
            new sendername[MAX_PLAYER_NAME];
            new vehicless;
            new newcar = GetPlayerVehicleID(playerid);
            if(!IsABike(newcar))
            {
                if(playerVariables[playerid][pCarID1] != newcar || playerVariables[playerid][pCarID2] != newcar || playerVariables[playerid][pCarID3] != newcar || playerVariables[playerid][pCarID4] != newcar)
                {
                    vehicless = GetVehicleModel(newcar) - 400;
                    vehicless = GetVehicleModel(newcar) - 400;
                    GetPlayerName(playerid, sendername, sizeof(sendername));
                    if(GetPlayerState(playerid) != PLAYER_STATE_DRIVER) return SendClientMessage(playerid, -1, "You need to be the driver of the vehicle");
                    GetVehicleParamsEx(GetPlayerVehicleID(playerid), engine, lights, alarm, doors, bonnet, boot, objective);
                    if(HUndercover[playerid] == 0)
                    {
                            if(engine == 1)
                            {
                                SetVehicleParamsEx(GetPlayerVehicleID(playerid), 0, lights, alarm, doors, bonnet, boot, objective);
                                format(szMessage, sizeof(szMessage), "* %s stops the engine of his %s.", sendername, aVehicleNames[vehicless]);
                                nearByMessage(playerid, COLOR_PURPLE, szMessage);
                            }
                            else
                            {
                                SetVehicleParamsEx(GetPlayerVehicleID(playerid), 1, lights, alarm, doors, bonnet, boot, objective);
                                format(szMessage, sizeof(szMessage), "* %s starts the engine of his %s.", sendername, aVehicleNames[vehicless]);
                                nearByMessage(playerid, COLOR_PURPLE, szMessage);
                            }
                    }
                    else
                    {
                            if(engine == 1)
                            {
                                SetVehicleParamsEx(GetPlayerVehicleID(playerid), 0, lights, alarm, doors, bonnet, boot, objective);
                                format(szMessage, sizeof(szMessage), "* An unknown hitman stops the engine of his %s.", aVehicleNames[vehicless]);
                                nearByMessage(playerid, COLOR_PURPLE, szMessage);
                            }
                            else
                            {
                                SetVehicleParamsEx(GetPlayerVehicleID(playerid), 1, lights, alarm, doors, bonnet, boot, objective);
                                format(szMessage, sizeof(szMessage), "* An unknown hitman starts the engine of his %s.", aVehicleNames[vehicless]);
                                nearByMessage(playerid, COLOR_PURPLE, szMessage);
                            }
                    }
                }
                else
                {   vehicless = GetVehicleModel(newcar) - 400;
                    vehicless = GetVehicleModel(newcar) - 400;
                    GetPlayerName(playerid, sendername, sizeof(sendername));
                    if(playerVariables[playerid][TireFlat] > 0)
                    {
                        if(engine == 1)
                        {
                            SetVehicleParamsEx(GetPlayerVehicleID(playerid), 0, lights, alarm, doors, bonnet, boot, objective);
                            format(szMessage, sizeof(szMessage), "* %s stops the engine of his %s.", sendername, aVehicleNames[vehicless]);
                            nearByMessage(playerid, COLOR_PURPLE, szMessage);
                        }
                        else
                        {
                            SetVehicleParamsEx(GetPlayerVehicleID(playerid), 1, lights, alarm, doors, bonnet, boot, objective);
                            format(szMessage, sizeof(szMessage), "* %s starts the engine of his %s.", sendername, aVehicleNames[vehicless]);
                            nearByMessage(playerid, COLOR_PURPLE, szMessage);
                        }
                    }
                    else SendClientMessage(playerid, -1, "You can't start your car because you have flat tire.");
                }

            }
            return 1;
        }
I added the restriction but it's not working , i still can start the car, my server uses 4 personal vehicles , but if i let only 2 on the row it's working , any idees?
This is the restriction who is not working if i put 4 cars:
pawn Код:
if(playerVariables[playerid][pCarID1] != newcar || playerVariables[playerid][pCarID2] != newcar || playerVariables[playerid][pCarID3] != newcar || playerVariables[playerid][pCarID4] != newcar)



Re: Help with 4 restrictions on 1 row , i give rep ++ - buburuzu19 - 17.12.2014

anyone