why does my server restarts when using this command?
#1

hey all,

when i use one of these commands(/v park, /v respawn and /v get) then my server restarts....

pawn Код:
CMD:v(playerid, params[])
{
    if(!strcmp(params,"park", true, 4))
    {
        print("begin");
        if(GetPlayerVehicleID(playerid) != OtherCars[playerid][0] || GetPlayerVehicleID(playerid) != OtherCars[playerid][1] || GetPlayerVehicleID(playerid) != OtherCars[playerid][2] || GetPlayerVehicleID(playerid) != OtherCars[playerid][3]) return SendClientMessage(playerid, COLOR_RED, "This ain't your car.");
        print("checked if its right car");
        new Float:x, Float:y, Float:z, Float:angle;
        print("variables created");
        GetVehiclePos(PlayerVeh, x, y, z);
        print("getvehiclepos");
        GetVehicleZAngle(PlayerVeh, angle);
        print("getangle");
        SaveFloatToCarSlot(playerid, CurrentSlot(playerid), "XSpawn", x );
        print("saved x");
        SaveFloatToCarSlot(playerid, CurrentSlot(playerid), "YSpawn", y );
        print("saved y");
        SaveFloatToCarSlot(playerid, CurrentSlot(playerid), "ZSpawn", z );
        print("saved z");
        SaveFloatToCarSlot(playerid, CurrentSlot(playerid), "ASpawn", angle );
        print("saved angle");
        SetVehicleToRespawn(PlayerVeh);
        print("respawned car");
        SetVehiclePos(PlayerVeh, x, y, z);
        print("setvehiclepos");
        SetVehicleZAngle(PlayerVeh, angle);
        print("angle set");
        PutPlayerInVehicle(playerid, PlayerVeh, 0);
        print("player in car");
        SendClientMessage(playerid, COLOR_WHITE, "Car Succesfully Parked.");
        print("end");
    }
    else if(!strcmp(params, "get", true, 3))
    {
        if(IsPlayerInAnyVehicle(playerid)) return SendClientMessage(playerid, COLOR_BLUE, "you need to be onfoot to teleport vehicles");
        new string1[50], string2[50], string3[50], string4[50], string[128];
        if(PlayerCars[playerid][0] != -1)
        {
            format(string1, sizeof(string1), "%s", GetVehicleNameByModel(PlayerCars[playerid][0]));
        }
        else if(PlayerCars[playerid][0] == -1 )
        {
            format(string1, sizeof(string1), "Empty Slot");
        }
        if( PlayerCars[playerid][1] != -1 )
        {
            format(string2, sizeof(string2), "%s", GetVehicleNameByModel(PlayerCars[playerid][1]));
        }
        else if( PlayerCars[playerid][1] == -1 )
        {
            format(string2, sizeof(string2), "Empty Slot");
        }
        if( PlayerCars[playerid][2] != -1 )
        {
            format(string3, sizeof(string3), "%s", GetVehicleNameByModel(PlayerCars[playerid][2]));
        }
        else if( PlayerCars[playerid][2] == -1 )
        {
            format(string3, sizeof(string3), "Empty Slot");
        }
        if( PlayerCars[playerid][3] != -1 )
        {
            format(string4, sizeof(string4), "%s", GetVehicleNameByModel(PlayerCars[playerid][3]));
        }
        else if( PlayerCars[playerid][3] == -1 )
        {
            format(string4, sizeof(string4), "Empty Slot");
        }
        format(string, sizeof(string), "%s\n%s\n%s\n%s", string1, string2, string3, string4);
        ShowPlayerDialog(playerid, DIALOG_GETCARS, DIALOG_STYLE_LIST, "Vehicle Respawning", string, "Respawn", "Cancel");
    }
    else if(!strcmp(params, "respawn", true, 7))
    {
        new string1[50], string2[50], string3[50], string4[50], string[128];
        if(PlayerCars[playerid][0] != -1)
        {
            format(string1, sizeof(string1), "%s", GetVehicleNameByModel(PlayerCars[playerid][0]));
        }
        else if(PlayerCars[playerid][0] == -1 )
        {
            format(string1, sizeof(string1), "Empty Slot");
        }
        if( PlayerCars[playerid][1] != -1 )
        {
            format(string2, sizeof(string2), "%s", GetVehicleNameByModel(PlayerCars[playerid][1]));
        }
        else if( PlayerCars[playerid][1] == -1 )
        {
            format(string2, sizeof(string2), "Empty Slot");
        }
        if( PlayerCars[playerid][2] != -1 )
        {
            format(string3, sizeof(string3), "%s", GetVehicleNameByModel(PlayerCars[playerid][2]));
        }
        else if( PlayerCars[playerid][2] == -1 )
        {
            format(string3, sizeof(string3), "Empty Slot");
        }
        if( PlayerCars[playerid][3] != -1 )
        {
            format(string4, sizeof(string4), "%s", GetVehicleNameByModel(PlayerCars[playerid][3]));
        }
        else if( PlayerCars[playerid][3] == -1 )
        {
            format(string4, sizeof(string4), "Empty Slot");
        }
        format(string, sizeof(string), "%s\n%s\n%s\n%s", string1, string2, string3, string4);
        ShowPlayerDialog(playerid, DIALOG_RESPAWNCARS, DIALOG_STYLE_LIST, "Vehicle Respawning", string, "Respawn", "Cancel");
    }
    else return SendClientMessage(playerid, COLOR_YELLOW, "Correct Usage: /v [PARK/GET/RESPAWN]");
    return 1;
}
as you can see i made debug messages at 1 of the cmds, but it doesnt even prints the first print, it just restarts at the very beginning...


whats wrong with those cmds?

greets
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)