Vehicle Problem.
#1

Hey guys!
I am creating my own admin filterscript with sscanf,zcmd and mysql.

My problem:
I have a "Respawn Cars" command (/respawncars). And when I type it it respawns all the vehicles but the player's cars doesnt respawn. It stays there. How to fix it?

Code:
PHP код:
CMD:respawncars(playerid,params[]){
     if(
P_DATA[playerid][alevel] < 4)return SendClientMessage(playerid,-1,"{FFFFFF}You must be{FF0000} Level 4{FFFFFF} to use this command.");
     for(new 
v=0v<MAX_VEHICLESv++){
     
SetVehicleToRespawn(v);
     }
     new 
name[MAX_PLAYER_NAME],str[256];
     
GetPlayerName(playerid,name,sizeof(name));
     
format(str,sizeof(str),"{FFFF00}%s{FFFFFF} has respawned all vehicles!",name);
     
SendClientMessageToAll(-1,str);
     return 
1;

Reply
#2

Anyone?
Reply
#3

what do you mean with
Код:
the player's cars
Reply
#4

When a player does the /car command.
Reply
#5

Try this:
on the top of the script
PHP код:
new bool:Spawned[MAX_VEHICLES]; 
Under the spawn car command
PHP код:
//Beside the create vehicle type
//new car = CreateVehicle(.....
Spawned[car] = true
Then under the respawn command
PHP код:
for(new 0MAX_VEHICLES;x++)
{
    if(
Spawned[x] == true)
    {
          
SetVehicleToRespawn(x); 
    }

I'm not sure but try
Reply
#6

Quote:
Originally Posted by nezo2001
Посмотреть сообщение
Try this:
on the top of the script
PHP код:
new bool:Spawned[MAX_VEHICLES]; 
Under the spawn car command
PHP код:
//Beside the create vehicle type
//new car = CreateVehicle(.....
Spawned[car] = true
Then under the respawn command
PHP код:
for(new 0MAX_VEHICLES;x++)
{
    if(
Spawned[x] == true)
    {
          
SetVehicleToRespawn(x); 
    }

I'm not sure but try
Unfortunately I get these errors:
Код:
C:\Users\Chris\Desktop\GTA SAMP Test Server\filterscripts\CAdmin.pwn(409) : error 028: invalid subscript (not an array or too many subscripts): "Spawned"
C:\Users\Chris\Desktop\GTA SAMP Test Server\filterscripts\CAdmin.pwn(409) : error 017: undefined symbol "car"
C:\Users\Chris\Desktop\GTA SAMP Test Server\filterscripts\CAdmin.pwn(409) : error 029: invalid expression, assumed zero
C:\Users\Chris\Desktop\GTA SAMP Test Server\filterscripts\CAdmin.pwn(409) : fatal error 107: too many error messages on one line

Compilation aborted.Pawn compiler 3.2.3664	 	 	Copyright © 1997-2006, ITB CompuPhase


4 Errors.
Reply
#7

Removed.
Reply
#8

how the code
Reply
#9

PHP код:
COMMAND:respawnallcars(playeridparams[])
{
    if(
P_DATA[playerid][alevel] < 4)return SendClientMessage(playerid,-1,"{FFFFFF}You must be{FF0000} Level 4{FFFFFF} to use this command."); 
    
SendClientMessageToAll(-1"{ff0000}(( WARNING: {FFFFFF}Unoccupied vehicles will be respawned in 20 seconds! {ff0000}))");
    
PlayerLoop(i)
    {
        
SetVehicleToRespawn(v); 
                new 
name[MAX_PLAYER_NAME],str[256]; 
     
GetPlayerName(playerid,name,sizeof(name)); 
     
format(str,sizeof(str),"{FFFF00}%s{FFFFFF} has respawned all vehicles!",name); 
     
SendClientMessageToAll(-1,str); 
    }
    return 
1;

try it
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)