ADMINCAR!!!
#1

Hi People! How to create admin car script? example: /admincar [car id]

ADMIN CAR, PLATE: ADMIN


Thank You!!
Reply
#2

PHP код:
CMD:admincar(playeridparams[])
{
    
i(!IsPlayerLoggedIn(playerid)) return SendClientMessage(playeridCOLOR_RED"You are not logged in!");
    if(!
IsPlayerAdmin(playerid)) return SendClientMessage(playeridCOLOR_RED"You are not an admin");
    if(
sscanf(params"d"carid)) return SendClientMessage(playeridCOLOR_RED"/admincar (carid)");
    new 
Pos[3];
    
GetPlayerPos(playeridPos[0], Pos[1], Pos[2]);
    new 
admincar CreateVehicle(caridPos[0], Pos[1], Pos[2], 18000, -10);
    
SendClientMessage(playeridCOLOR_RED"Car spawned!");
    
SetVehicleNumberPlate(admincar"Admin");

I've just made this command for you just because you are a beginner i see, This car won't respawn if destroyed..
Reply
#3

Thank You!!
Reply
#4

What'is error??

ADMINCAR SPAWNED:

Код:
CMD:admincar(playerid, params[])
{
    if(!IsPlayerLoggedIn(playerid)) return SendClientMessage(playerid, COLOR_RED, "No Logged!");
    if(!IsPlayerAdmin(playerid)) return SendClientMessage(playerid, COLOR_RED, "No admin");
    if(sscanf(params, "d", carid)) return SendClientMessage(playerid, COLOR_RED, "/adminkocsi [ Jбrmű ID ]");
    new Pos[3];
    new string[500];
    new carid[500];
    //tag misGetPlayerPos(playerid, Pos[0], Pos[1], Pos[2]);
    new admincar = CreateVehicle(carid, Pos[0], Pos[1], Pos[2], 180, 0, 0, -1, 0);
    SendClientMessage(playerid, COLOR_RED, "(( Spawned %s type car");
    format(string,sizeof(string),"(( Spawned Admin Car, ID: %d |  Name: %s | SA:MP Modell: %s ))", carid, RealName[modelid - 400], GameName[modelid - 400]);
	SendClientMessage(playerid,COLOR_WHITE,string);
    SetVehicleNumberPlate(admincar, "ADMIN");
}
Код:
warning 213: tag mismatch
error 035: argument type mismatch (argument 1)
error 017: undefined symbol "carid"

AND HOW TO DESTROY ADMIN CAR
Reply
#5

Pos needs to be a float.

I'm not sure what you're trying to do with carid.

A better way of doing this entire thing would be:

PHP код:
new bool:AdminVehicle[MAX_VEHICLES];
CMD:admincar(playeridparams[])
{
    if(!
IsPlayerAdmin(playerid)) 
        return 
SendClientMessage(playeridCOLOR_RED"No admin");
    
    new
        
modelid,
        
vehicleid,
        
Float:Pos[3],
        
str[128],
        
name[32]
    ; 
    
    if(
sscanf(params"i"modelid))
        return 
SendClientMessage(playeridCOLOR_RED"/adminkocsi [ Jбrmű ID ]");
    
    if(
modelid 400 || modelid 611)
        return 
SendClientMessage(playeridCOLOR_RED"You specified an invalid model."); 
        
    
GetPlayerPos(playeridPos[0], Pos[1], Pos[2]); 
    
    
vehicleid CreateVehicle(modelidPos[0], Pos[1], Pos[2], 90.0random(255), random(255), -1); 
    
SetVehicleNumberPlate(vehicleid"Admin"); 
    
    
SetVehicleToRespawn(vehicleid);
    
AdminVehicle[vehicleid] = true;
    
    
format(name32"%s"RealName[modelid 400]); 
    
    
format(strsizeof(str), "(( You spawned an admin car. Vehicle ID: %i, Name: %s ))"vehicleidname);
    
SendClientMessage(playeridCOLOR_REDstr); 
    return 
1;

Reply
#6

Okey Thank You Arthur!!! And How to destroy car?? example: destroyadmincar
Reply
#7

Just check if the vehicle's an admin car.

PHP код:
CMD:destroyadmincar(playeridparams[])
{
     if(!
IsPlayerAdmin(playerid))  
        return 
SendClientMessage(playeridCOLOR_RED"No admin"); 
    
    if(
GetPlayerState(playerid) != PLAYER_STATE_DRIVER)
        return 
SendClientMessage(playeridCOLOR_RED"You aren't driving a car.");
        
    new
        
vehicleid GetPlayerVehicleID(playerid),
        
str[128]
    ;
        
    if(!
AdminVehicle[vehicleid])
        return 
SendClientMessage(playeridCOLOR_RED"You aren't driving an admin car."); 
        
    
AdminVehicle[vehicleid] = false;
    
    
format(strsizeof(str), "(( You destroyed Admin vehicle ID %i. ))"vehicleid);
    
SendClientMessage(playeridCOLOR_REDstr); 
        
    
DestroyVehicle(vehicleid); 
    return 
1;

Reply
#8

Thank You Boss!! + Respect!: And My Problem: mysql save and load, more more xd
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)