[Help]Delete Old Vehicle
#1

Hello Guys
i Want Know When Admin Write /v any vehicle the old vehicle delete
any one know how ?
please help +rep
this my code
PHP код:
CMD:v(playeridparams[])
{
if(
PlayerInfo[playerid][pRank] >= && PlayerInfo[playerid][pRank] <= 8)
{
        new 
Vehicle[50];
        if(!
sscanf(params"s[50]"Vehicle))
        {
                new 
string[128], Float:Pos[4];
                
GetPlayerPos(playeridPos[0],Pos[1],Pos[2]); GetPlayerFacingAngle(playeridPos[3]);
                new 
veh GetVehicleModelID(Vehicle);
                if(
veh 400 || veh 611) return SendClientMessage(playeridCOLOR_RED"This is not a valid vehicle name! Please try again ");
                if(
IsPlayerInAnyVehicle(playerid)) { DestroyVehicle(GetPlayerVehicleID(playerid)); }
                
GetXYInFrontOfPlayer(playeridPos[0], Pos[1], 5);
                new 
PVeh CreateVehicle(vehPos[0], Pos[1], Pos[2], Pos[3]+90, -1, -1, -1);
                
LinkVehicleToInterior(PVehGetPlayerInterior(playerid)); SetVehicleVirtualWorld(PVehGetPlayerVirtualWorld(playerid));
                
format(stringsizeof string"You spawned a %s. ID: %i. "aVehicleNames[veh 400], veh);
                
SendClientMessage(playeridCOLOR_GREENstring);
        }
        } else return 
SendClientMessage(playeridCOLOR_LIGHTGREEN"Usage: /v [vehiclename] ");
return 
1;

and cmd aduty
there problems the all can text in up his head on Duty admins and not admins
PHP код:
CMD:aduty(playerid//Doesnt need params function
{
    if(
PlayerInfo[playerid][pRank] >= && PlayerInfo[playerid][pRank] <= || IsPlayerAdmin(playerid)) //If you use rcon admin delete (PlayerInfo[playerid][pAdmin] >=1 ||
    
{
        if (
aDuty[playerid] == 0//Check if player is on duty
        
{
            new 
string[128];
            new 
Float:x,Float:y,Float:z;
            new 
Text3D:label Create3DTextLabel("Admin On Duty!"COLOR_DRED,x,y,z40.000); //Creates 3d text label at player position
            
GetPlayerPos(playerid,x,y,z); //Looks for players position
            
SetPlayerHealth(playerid,999999); //makes player godmode
            
SetPlayerColor(playerid,COLOR_DRED); //set admin colour red
            
SetPlayerSkin(playerid,294); //set admin skin to 294
            
format(string,sizeof(string), "%s is now on Duty!",GetPlayerNameEx(playerid)); //here you format string to send to players
            
SendClientMessageToAll(COLOR_DRED,string); //send string to players
            
SendClientMessage(playerid,COLOR_DRED,"You are now on duty!"); //Tell admin he is now on duty
            
Attach3DTextLabelToPlayer(label,playerid,0.00.00.7); //attach 3d text label made before to player
            
aDuty[playerid] = 1//Set player on duty
        
}
        else if (
aDuty[playerid] == 1//Check if player is on duty
        
{
            new 
string[128];
            new 
Float:x,Float:y,Float:z;
            new 
Text3D:label Create3DTextLabel("Admin On Duty!"COLOR_DRED,x,y,z40.000);
            
Delete3DTextLabel(label); //Delete 3d text label saying "Admin On Duty!"
            
SetPlayerHealth(playerid,100); //sets player health back to 100
            
format(string,sizeof(string)," %s is now off Duty!",GetPlayerNameEx(playerid)); //Format string to send to players
            
SendClientMessageToAll(COLOR_DRED,string); //send players string
            
SendClientMessage(playeridCOLOR_DRED,"You are now off duty!"); //send admin message he is off duty
            
aDuty[playerid] = 0//sets admin off duty
        
}
    }
    else
        
SendClientMessage(playerid,COLOR_DRED,"You are not high level enough!"); //Error message to send to players who arent admins
    
return 1;

Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)