How to make vehicle ID checker?
#1

How to do that the server checks for a vehicle id . I have a command / respawncar [ vehicleid ] . I have 5 vehicles , type / respawncar 10 and writes that respawned vehicle but the vehicle does not exist.
I dont know how to make vehicle id checker and error message if this id doest not exit. " this vehicle id does not exist.


Thanks.
Reply
#2

https://sampwiki.blast.hk/wiki/Creating_Commands

then when you are checking if a vehicle exists, you need to check if ID != INVALID_VEHICLE_ID

Example:
pawn Код:
if(!strcmp(cmd, "/checkcar"))
{
    new id;
    if(sscanf(params, "d", id)) return SendClientMessage(playerid, -1, "USE: /checkcar [ID]");
    else
    {
        if(id == INVALID_VEHICLE_ID) return SendClientMessage(playerid,-1," That vehicles doesn't exist!");
        RespawnVehicle(id);
    }
    return 1;
}
Reply
#3

delete this post pls.
Reply
#4

Again say me: respawned car id but this car id dont on server.





Код:
CMD:dvehid( playerid, params[ ] )
{
    if(IsLogged[playerid] == false) return SendClientMessage(playerid, COLOR_RED, ""COL_ORANGE"HF-Protect | "COL_WHITE"Moras biti ulogiran kako bi mogao koristiti "COL_CYAN"komande"COL_RED"!");
    if(PlayerInfo[playerid][pAdmin] < 6) return SendClientMessage(playerid, COLOR_RED, "[GRESKA]: "COL_WHITE"Nemas prava za koristenje ove komande.");
    if(aDuty[playerid] == 0) return SendClientMessage(playerid, COLOR_RED, "[GRESKA]: "COL_WHITE"Nisi na Admin duznosti.");
    new vehicleid;
    if(sscanf(params, "d", vehicleid)) return SendClientMessage(playerid, COLOR_CYAN, "[KORISTI]: "COL_WHITE" /dvehid [Vehicle ID]");
    if(vehicleid == INVALID_VEHICLE_ID) return SendClientMessage(playerid,COLOR_RED,"[GRESKA]: "COL_WHITE"Taj ID vozila nema na serveru.");
    {
    DestroyVehicle(vehicleid);
    //
    new pName[MAX_PLAYER_NAME];
    new string[128];
    GetPlayerName(playerid, pName, MAX_PLAYER_NAME);

    format(string, sizeof(string), ""COL_PURPLE"[ADMIN]: "COL_GREY"Admin %s je unistio vozilo. ID vozila: %d.", pName, vehicleid);
    SendMessageToAdmins(COLOR_ORANGE, string);

    format(string, sizeof(string), ""COL_ORANGE"[SERVER]: "COL_GREY"Unistio si vozilo. ID vozila: %d. ",vehicleid);
    SendClientMessage(playerid, COLOR_ORANGE, string);
    }
    return 1;
}
Reply
#5

who can help?
Reply
#6

bump
Reply
#7

This would work:

pawn Код:
CMD:dvehid( playerid, params[ ] )
{
    if(IsLogged[playerid] == false) return SendClientMessage(playerid, COLOR_RED, ""COL_ORANGE"HF-Protect | "COL_WHITE"Moras biti ulogiran kako bi mogao koristiti "COL_CYAN"komande"COL_RED"!");
    if(PlayerInfo[playerid][pAdmin] < 6) return SendClientMessage(playerid, COLOR_RED, "[GRESKA]: "COL_WHITE"Nemas prava za koristenje ove komande.");
    if(aDuty[playerid] == 0) return SendClientMessage(playerid, COLOR_RED, "[GRESKA]: "COL_WHITE"Nisi na Admin duznosti.");
    new vehicleid;
    if(sscanf(params, "d", vehicleid)) return SendClientMessage(playerid, COLOR_CYAN, "[KORISTI]: "COL_WHITE" /dvehid [Vehicle ID]");
    if(vehicleid == INVALID_VEHICLE_ID) return SendClientMessage(playerid,COLOR_RED,"[GRESKA]: "COL_WHITE"Taj ID vozila nema na serveru.");
    DestroyVehicle(vehicleid);
    //
    new pName[MAX_PLAYER_NAME];
    new string[128];
    GetPlayerName(playerid, pName, MAX_PLAYER_NAME);

    format(string, sizeof(string), ""COL_PURPLE"[ADMIN]: "COL_GREY"Admin %s je unistio vozilo. ID vozila: %d.", pName, vehicleid);
    SendMessageToAdmins(COLOR_ORANGE, string);

    format(string, sizeof(string), ""COL_ORANGE"[SERVER]: "COL_GREY"Unistio si vozilo. ID vozila: %d. ",vehicleid);
    SendClientMessage(playerid, COLOR_ORANGE, string);
    return 1;
}
Reply
#8

Quote:
Originally Posted by AdHaM612
Посмотреть сообщение
This would work:

pawn Код:
CMD:dvehid( playerid, params[ ] )
{
    if(IsLogged[playerid] == false) return SendClientMessage(playerid, COLOR_RED, ""COL_ORANGE"HF-Protect | "COL_WHITE"Moras biti ulogiran kako bi mogao koristiti "COL_CYAN"komande"COL_RED"!");
    if(PlayerInfo[playerid][pAdmin] < 6) return SendClientMessage(playerid, COLOR_RED, "[GRESKA]: "COL_WHITE"Nemas prava za koristenje ove komande.");
    if(aDuty[playerid] == 0) return SendClientMessage(playerid, COLOR_RED, "[GRESKA]: "COL_WHITE"Nisi na Admin duznosti.");
    new vehicleid;
    if(sscanf(params, "d", vehicleid)) return SendClientMessage(playerid, COLOR_CYAN, "[KORISTI]: "COL_WHITE" /dvehid [Vehicle ID]");
    if(vehicleid == INVALID_VEHICLE_ID) return SendClientMessage(playerid,COLOR_RED,"[GRESKA]: "COL_WHITE"Taj ID vozila nema na serveru.");
    DestroyVehicle(vehicleid);
    //
    new pName[MAX_PLAYER_NAME];
    new string[128];
    GetPlayerName(playerid, pName, MAX_PLAYER_NAME);

    format(string, sizeof(string), ""COL_PURPLE"[ADMIN]: "COL_GREY"Admin %s je unistio vozilo. ID vozila: %d.", pName, vehicleid);
    SendMessageToAdmins(COLOR_ORANGE, string);

    format(string, sizeof(string), ""COL_ORANGE"[SERVER]: "COL_GREY"Unistio si vozilo. ID vozila: %d. ",vehicleid);
    SendClientMessage(playerid, COLOR_ORANGE, string);
    return 1;
}
again same problem :S
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)