SA-MP Forums Archive
command debugging/bugging/halting(not crashing) the server. - 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)
+---- Forum: Help Archive (https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: command debugging/bugging/halting(not crashing) the server. (/showthread.php?tid=203670)



command debugging/bugging/halting(not crashing) the server. - The_Gangstas - 27.12.2010

this command is somewhat, weird. when i type /v bus, it crashes the server,ym friend types /v bus, it doesnt crahs whenhe types it, crashs when i do and my other friend does. tested many times.
friend reported today, he typed /v fbi, then the server went bugged

- By Bugged I Completely Mean, The Server Makes Ppl Can't Connect. There Game Stops At Connected. Joining The Game.

And the players that were in the server - they get bugged , they cant type or anything

pawn Код:
CMD:v(playerid,params[])
{
    if(PlayerInfo[playerid][AdminLevel] >= 0 || IsPlayerAdmin(playerid))
    {
        new vname[25];
        if(sscanf(params,"s[25]",vname)) return SendClientMessage(playerid,RED,"Usage: /v [Vehiclename]");
        if(aveh[playerid] != 0) DestroyVehicle(aveh[playerid]);
        new Float:X,Float:Y,Float:Z,Float:ROT;
        GetPlayerPos(playerid,X,Y,Z);
        GetPlayerFacingAngle(playerid,ROT);
        if(IsNumeric(vname))
        {
            if(!IsValidVehicle(strval(vname))) return SendClientMessage(playerid,RED,"Error:Invalid Vehicleid");
            aveh[playerid] = CreateVehicle(strval(vname),X,Y,Z,ROT,-1,-1,60);
            SetVehicleHealth(aveh[playerid],997);
        }
        else
        {
            if(!IsValidVehicle(ReturnVehicleID(vname))) return SendClientMessage(playerid,RED,"Error:Invalid Name");
            aveh[playerid] = CreateVehicle(ReturnVehicleID(vname),X,Y,Z,ROT,-1,-1,60);
            SetVehicleHealth(aveh[playerid],997);
        }
        PutPlayerInVehicle(playerid, aveh[playerid], 0);
        AddVehicleComponent(GetPlayerVehicleID(playerid), 1010);
        LinkVehicleToInterior(aveh[playerid], GetPlayerInterior(playerid));
        SetVehicleVirtualWorld(aveh[playerid], GetPlayerVirtualWorld(playerid));
    }
    return 1;
}



Re: command debugging/bugging/halting(not crashing) the server. - iggy1 - 27.12.2010

Maybe its because you have two consecutive else's. (and only one if)
eg, you cant have if >> else >> else. The correct format would be if >> else if >> else.


Re: command debugging/bugging/halting(not crashing) the server. - The_Gangstas - 27.12.2010

i just added that last else if, ingore that sorry lol.

also

pawn Код:
ReturnVehicleID(vName[])//by Ryder
{
    Loop(x, 211)
    {
        if(strfind(aVehicleNames[x], vName, true) != -1)
        return x + 400;
    }
    return -1;
}



Re: command debugging/bugging/halting(not crashing) the server. - MadeMan - 27.12.2010

Show IsValidVehicle function.