SA-MP Forums Archive
Some errors [Need fix] - 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: Some errors [Need fix] (/showthread.php?tid=318663)



Some errors [Need fix] - viddo - 16.02.2012

Код:
C:\Users\Viddo\Desktop\LARP 4.0\LARP 4.0 D\gamemodes\larp.pwn(27670) : error 029: invalid expression, assumed zero
Код:
if(pveh == 510 || pveh == 462 || pveh == 481 || pveh == 509) return 1;)
Код:
C:\Users\Viddo\Desktop\LARP 4.0\LARP 4.0 D\gamemodes\larp.pwn(27624) : warning 219: local variable "idcar" shadows a variable at a preceding level
Код:
 new idcar = GetPlayerVehicleID(playerid);



Re: Some errors [Need fix] - 2KY - 16.02.2012

(There was a ) between "1" and ";"
pawn Код:
if(pveh == 510 || pveh == 462 || pveh == 481 || pveh == 509) return 1;
(You already have the variable assigned elsewhere)
pawn Код:
idcar = GetPlayerVehicleID(playerid);



Re: Some errors [Need fix] - Mark_Weston - 16.02.2012

pawn Код:
if(!strcmp(cmd, "/engine", true))
    {
        if(IsPlayerConnected(playerid))
        {
            if(IsPlayerInAnyVehicle(playerid))
            {
                if(!engineOn[GetPlayerVehicleID(playerid)])
                {
                    if(GetPlayerState(playerid) == PLAYER_STATE_PASSENGER) return 1;
                    if(pveh == 510 || pveh == 462 || pveh == 481 || pveh == 509) return 1;
                    if(IsARentableBike(idcar))
                    {
                        if(HireCar[playerid] != idcar) return 1;
                    }
                    if(IsAHarvest(idcar)) return 1;
                    if(IsADrugHarvest(idcar)) return 1;
                    if(IsASweeper(idcar)) return 1;
                    if(IsASalesVehicle(idcar)) return 1;


                    if(CanTurnEngine[playerid] != idcar && CanTurnEngine[playerid] == 9999)
                        return SendClientMessage(playerid, COLOR_GREY,"* You cannot turn this car's engine!");

                    format(string, sizeof(string), "* %s spins a key and tries to start vehicle engine.", sendername);
                    ProxDetector(30.0, playerid, string, COLOR_CHAT1,COLOR_CHAT2,COLOR_CHAT3,COLOR_CHAT4,COLOR_CHAT5);
                    if(PlayerInfo[playerid][pAdmin] < 1337 && PlayerInfo[playerid][pAdminDuty] == 1)
                    {
                        SetTimerEx("StartingTheVehicle",1,0,"i",playerid);
                    }
                    else
                    {
                        SetTimerEx("StartingTheVehicle",3500,0,"i",playerid);
                    }
                    GameTextForPlayer(playerid, "~w~Starting vehicle engine...",3500,3);
                    gEngine[playerid] = 1;
                    new y, m, d;
                    new h,mi,s;
                    getdate(y,m,d);
                    gettime(h,mi,s);
                    format(string,sizeof(string), "(%d/%d/%d)[%d:%d:%d] %s [CMD] -> /engine",d,m,y,h,mi,s,sendername);
                    CommandLog(string);
                    return 1;
                }
                else if(engineOn[GetPlayerVehicleID(playerid)])
                {
                    if(GetPlayerState(playerid) == PLAYER_STATE_PASSENGER) return 1;
                    if(pveh == 510 || pveh == 462 || pveh == 481 || pveh == 509) return 1;
                    if(IsARentableBike(idcar))
                    {
                        if(HireCar[playerid] != idcar) return 1;
                    }
                    if(IsAHarvest(idcar)) return 1;
                    if(IsADrugHarvest(idcar)) return 1;
                    if(IsASweeper(idcar)) return 1;

                    if(CanTurnEngine[playerid] != idcar && CanTurnEngine[playerid] == 9999)
                        return SendClientMessage(playerid, COLOR_GREY,"* You cannot turn this car's engine!");

                    format(string, sizeof(string), "* %s spins a key and turns off the engine.", sendername);
                    ProxDetector(30.0, playerid, string, COLOR_CHAT1,COLOR_CHAT2,COLOR_CHAT3,COLOR_CHAT4,COLOR_CHAT5);
                    GameTextForPlayer(playerid, "~w~Engine Turned Off.",3500,3);
                    gEngine[playerid] = 0;
                    engineOn[GetPlayerVehicleID(playerid)] = false;
                    TogglePlayerControllable(playerid, 0);//// ath the dealship's in the game, you can go there and try to get a car, buy when you do /v it spawns you a car, but you can take it away, idk how you can buy it,can you fix it where they cant leave with the car, they have to buy it first?
                    new y, m, d;
                    new h,mi,s;
                    getdate(y,m,d);
                    gettime(h,mi,s);
                    format(string,sizeof(string), "(%d/%d/%d)[%d:%d:%d] %s [CMD] -> /engine",d,m,y,h,mi,s,sendername);
                    CommandLog(string);
                    return 1;
                }
            }
        }
        return 1;
    }