Respawning Cars
#1

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.
Reply
#2

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;
}
Reply
#3

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
Reply
#4

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

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


Forum Jump:


Users browsing this thread: 1 Guest(s)