SA-MP Forums Archive
How to make vehicle ID checker? - 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: How to make vehicle ID checker? (/showthread.php?tid=561184)



How to make vehicle ID checker? - TiXz0r - 01.02.2015

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.


Re: How to make vehicle ID checker? - StreetGT - 01.02.2015

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;
}



Re: How to make vehicle ID checker? - TiXz0r - 01.02.2015

delete this post pls.


Re: How to make vehicle ID checker? - TiXz0r - 01.02.2015

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;
}



Re: How to make vehicle ID checker? - TiXz0r - 01.02.2015

who can help?


Re: How to make vehicle ID checker? - TiXz0r - 01.02.2015

bump


Re: How to make vehicle ID checker? - AdHaM612 - 01.02.2015

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;
}



Re: How to make vehicle ID checker? - TiXz0r - 02.02.2015

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