SA-MP Forums Archive
Respawning Cars - 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: Respawning Cars (/showthread.php?tid=357416)



Respawning Cars - fuem1907 - 07.07.2012

Hi There
I can see Car id's in my server with /dl commands.
I want to respawn a car.
I mean I want to use a command like this.
/respawncarid 24
Can someone help me about this ? Thank you.


Re: Respawning Cars - Jarnu - 07.07.2012

pawn Код:
CMD:respawncarid( playerid, params[ ] )
{
    static
        vehID
    ;

    if ( sscanf( params, "i",  vehID ) )
        return SendClientMessage( playerid, COLOR_RED, "USAGE: /respawncarid < vehID >" );

    if ( vehID == INVALID_VEHICLE_ID )
        return SendClientMessage( playerid, COLOR_RED, "ERROR: Invalid vehicle ID." );

    SetVehicleToRespawn( vehID );

    SendClientMessage( playerid, COLOR_RED, "Vehicle has been respawned succesfully." );

    return 1;
}



Re: Respawning Cars - MA_proking - 07.07.2012

pawn Код:
#define check_player_in_car true//make false if you not want to check player
CMD:respawncar(playerid, params[]) {
    if(isnull(params)) {
        SendClientMessage(playerid, 0xFFFFFFFFF, "/respawncar [id]");
        return 1;
    }
    if (params == INVALID_VEHICLE_ID ) return SendClientMessage( playerid, COLOR_RED, "ERROR: Invalid vehicle ID." );
    #if check_player_in_car == true
    for(new i=0; i<MAX_PLAYERS; i++){
    if(IsPlayerInVehicle(i, params))
    {
        SendClientMessage(playerid,0xFFFFFFFFF,"There is a player in vehicle");
        return 1;
    }
    }
    #endif
    SetVehicleToRespawn(params);
    SendClientMessage(playerid,0xFFFFFFFFF,"Vehicle is Respawned");
    return 1;
}
I use ZCMD you can use yours


Re: Respawning Cars - fuem1907 - 07.07.2012

Thanks Guys, I will talk with my pawn codder about this.I'm sure, He will use them.
Thanks a lot


Re: Respawning Cars - [MM]RoXoR[FS] - 07.07.2012

At top add
pawn Код:
#define dcmd(%1,%2,%3) if ((strcmp((%3)[1], #%1, true, (%2)) == 0) && ((((%3)[(%2) + 1] == 0) && (dcmd_%1(playerid, "")))||(((%3)[(%2) + 1] == 32) && (dcmd_%1(playerid, (%3)[(%2) + 2]))))) return 1
#include <sscanf2>
pawn Код:
public OnPlayerCommandText(playerid, cmdtext[])
{
    dcmd(respawncar,10,cmdtext);
    return 0;
}
dcmd_respawncar(playerid,params[])
{
    new id;
    if(sscanf(params,"i",id)) return SendClientMessage(playerid,-1,"Correct USAGE : /respawncar [vid]");
    if(id == INVALID_VEHICLE_ID) return SendClientMessage(playerid,-1,"InValid id");
    SetVehicleToRespawn(id);
    return 1;
}