Destroy Current Vehicles Help
#1

HI AnyOne can Fix My Script IF Player Spawn A Vehicles His Current Vehicles Destroy And Spawn New Car.

This Is My Scipt Please Put On My Script Tnx
PHP код:
COMMAND:vc(playeridparams[])
{
    if(
spawnn[playerid] == 0) return 1;
    if(!
adminLevel(playerid1))
        return 
0;
        
    new 
tempCar[10], vsIDmessage[128];
    if(
sscanf(params"s[10]"tempCar))
    {
        
Usage(playerid"vc(reate) <vehicle name>");
    }
    else
    {
        
        new 
Float:xFloat:yFloat:zFloat:a;
        
vsID    getVehicleModelFromName(tempCar);
        if(
vsID 400 || vsID 612)
        {
            
Server(playerid"Unknown vehicle name.");
        }
        else
        {
            
GetPlayerFacingAngle(playerida);
            
GetPlayerPos(playeridxyz);
            if(
vsID == 612)
            {
                
SetPlayerSpecialAction(playeridSPECIAL_ACTION_USEJETPACK);
            }
            else
            {
                for(new 
0MAX_ADMIN_VEHICLESi++)
                {
                    if(!
GM[adminV][i])
                    {
                        
GM[adminV][i] = CreateVehicle(vsIDxyzarandom(255), random(255), 600000);
                        
LinkVehicleToInterior(GM[adminV][i], GetPlayerInterior(playerid));
                        
SetVehicleVirtualWorld(GM[adminV][i], GetPlayerVirtualWorld(playerid));
                        
PutPlayerInVehicle(playeridGM[adminV][i], 0);
                        
format(messagesizeof(message), "You have spawned a "CHAT_YELLOW"%s"CHAT_WHITE"."vehicleNames[vsID 400]);
                        
Server(playeridmessage);
                        break;
                    }
                    
                    if(
== (MAX_ADMIN_VEHICLES 1))
                    {
                        
Server(playerid"Too many admin vehicle has been respawned, type "CHAT_YELLOW"/respawnallav "CHAT_WHITE"to respawn all admin vehicle.");
                    }
                }
            }
        }    
    }
    return 
1;

Reply
#2

Hold up, that's not what this section is for at all.


You can hire, or ask someone to do work for you in the "Looking for scripters/helpers" thread.

This is for if you have a problem with your code, not that you want someone to script things for you.
Reply
#3

Quote:
Originally Posted by Sew_Sumi
Посмотреть сообщение
Hold up, that's not what this section is for at all.


You can hire, or ask someone to do work for you in the "Looking for scripters/helpers" thread.

This is for if you have a problem with your code, not that you want someone to script things for you.
I Need Help For Complet My Script! This Forum For Scripting Help! Go And Read Rules!

Any One Can Fix It?
Reply
#4

Quote:
Originally Posted by alishvasis
Посмотреть сообщение
I Need Help For Complet My Script! This Forum For Scripting Help! Go And Read Rules!

Any One Can Fix It?
You should go read the rules again, because what you're asking, isn't what this section is actually for.

It's not for a fix, this is a complete addition to your script...
Reply
#5

Any One Can Fix It Plss TnXXXXXXxx
Reply
#6

What is your GM[adminv][i] variable for?
Reply
#7

Quote:
Originally Posted by Shinja
Посмотреть сообщение
What is your GM[adminv][i] variable for?
adminV[MAX_ADMIN_VEHICLES],
Reply
#8

I Use DestroyVehicle Function But Not Work Good! If Player In Vehicles And Take A New Vehicle My Cmd Destroy His Vehicle And Spawn a New Vehicle So Worked! But If Player Exit The Vehicle And Spawn A New Vehicle Dont Destroy Current Vehicles I Need Destroy His Current Vehicles At The All Time Take a new Vehicle!
This Is My Script
PHP код:
                                new currentveh;
                        
currentveh GetPlayerVehicleID(playerid);
                        
DestroyVehicle(currentveh); 
And This Is My Ful Car Spawn CMd For Admins
PHP код:
COMMAND:vc(playeridparams[])
{
    if(
spawnn[playerid] == 0) return 1;
    if(!
adminLevel(playerid1))
        return 
0;
        
    new 
tempCar[10], vsIDmessage[128];
    if(
sscanf(params"s[10]"tempCar))
    {
        
Usage(playerid"vc(reate) <vehicle name>");
    }
    else
    {
        
        new 
Float:xFloat:yFloat:zFloat:a;
        
vsID    getVehicleModelFromName(tempCar);
        if(
vsID 400 || vsID 612)
        {
            
Server(playerid"Unknown vehicle name.");
        }
        else
        {
            
GetPlayerFacingAngle(playerida);
            
GetPlayerPos(playeridxyz);
            if(
vsID == 612)
            {
                
SetPlayerSpecialAction(playeridSPECIAL_ACTION_USEJETPACK);
            }
            else
            {
                for(new 
0MAX_ADMIN_VEHICLESi++)
                {
                    if(!
GM[adminV][i])
                    {
                        new 
currentveh;    //<<<<<Not Work Good!
                        
currentveh GetPlayerVehicleID(playerid); //<<<<<Not Work Good!
                        
DestroyVehicle(currentveh);   //<<<<<Not Work Good!
                        
GM[adminV][i] = CreateVehicle(vsIDxyzarandom(255), random(255), 600000);
                        
LinkVehicleToInterior(GM[adminV][i], GetPlayerInterior(playerid));
                        
SetVehicleVirtualWorld(GM[adminV][i], GetPlayerVirtualWorld(playerid));
                        
PutPlayerInVehicle(playeridGM[adminV][i], 0);
                        
format(messagesizeof(message), "You have spawned a "CHAT_YELLOW"%s"CHAT_WHITE"."vehicleNames[vsID 400]);
                        
Server(playeridmessage);
                        break;
                    }
                    
                    if(
== (MAX_ADMIN_VEHICLES 1))
                    {
                        
Server(playerid"Too many admin vehicle has been respawned, type "CHAT_YELLOW"/respawnallav "CHAT_WHITE"to respawn all admin vehicle.");
                    }
                }
            }
        }    
    }
    return 
1;

Anyone Can Fix It ?
TnX So Much For Sa-mp Forum
Reply
#9

You need an
PHP код:
if(currentvehicle)
{
DestroyVehicle(currentvehicle);

PHP код:
//new currentveh;   <<<<<Not Work Good! because you shouldn't do this...
                        //currentveh = GetPlayerVehicleID(playerid); //<<<<<Not Work Good! 
if(currentvehicle[playerid])
{
DestroyVehicle(currentvehicle[playerid]);
}
                        
//DestroyVehicle(currentveh);   //<<<<<Not Work Good! 
before you create the next one.

currentvehicle will only work for the one, so if another person makes a new vehicle, it'll wipe out whoevers vehicle was last made.

You need it to be an array
PHP код:
new currentvehicle[MAX_PLAYERS]; 
up top of the script, not in the middle. Otherwise when one person uses it, there'll only be one vehicle ever spawned, no matter who uses the command.
Reply
#10

Quote:
Originally Posted by Sew_Sumi
Посмотреть сообщение
You need an [php]if(currentvehicle)
Gived To Me 2 Errors
Код HTML:
error 033: array must be indexed (variable "currentvehicle")
 error 035: argument type mismatch (argument 1)
I Have Put Your Script At This Line But Give Me Errors...
PHP код:
for(new 0MAX_ADMIN_VEHICLESi++)
                {
                    if(!
GM[adminV][i])
                    {
                        new 
currentvehicle[MAX_PLAYERS];
                        if(
currentvehicle)
                        {
                        
DestroyVehicle(currentvehicle);
                        }
                        
GM[adminV][i] = CreateVehicle(vsIDxyzarandom(255), random(255), 600000);
                        
LinkVehicleToInterior(GM[adminV][i], GetPlayerInterior(playerid));
                        
SetVehicleVirtualWorld(GM[adminV][i], GetPlayerVirtualWorld(playerid));
                        
PutPlayerInVehicle(playeridGM[adminV][i], 0);
                        
format(messagesizeof(message), "You have spawned a "CHAT_YELLOW"%s"CHAT_WHITE"."vehicleNames[vsID 400]);
                        
Server(playeridmessage);
                        break;
                    } 
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)