what's wrong with it?
#1

i tried to do that if you enter a NRG-500 it will send you a message and destroy the vehicle after 60 seconds... tell me what's wrong...
up:
Код:
new destroy_NRG[MAX_PLAYERS];
forward Destroy_NRG(playerid);
somewhere in script not in any public!:
Код:
public Destroy_NRG(playerid)
{
	KillTimer(destroy_NRG[playerid]);
	new vehicleid = GetPlayerVehicleID(playerid);
	DestroyVehicle(vehicleid);
	return 1;
}
in OnPlayerEnterVehicle:
Код:
if(vehicleid == 522 && ispassenger)
	{
	    KillTimer(destroy_NRG[playerid]);
	    destroy_NRG[playerid] = SetTimerEx("Destroy_NRG", 60000, false, "i", playerid);
	    SendClientMessage(playerid, COLOUR_LIGHTBLUE, "You just entered the vehicle 'NRG-500'");
	    SendClientMessage(playerid, COLOUR_RED, "This vehicle will deasapir in 60 seconds!");
	    return 1;
	}
and on GameModeInit:
Код:
CreateVehicle(522, 2493.2388,-1666.8898,12.9077,94.9658, 0, 0, 60000);
Reply
#2

Another classic case of someone mixing vehicle id's and model id's.
Reply
#3

Quote:
Originally Posted by Vince
Посмотреть сообщение
Another classic case of someone mixing vehicle id's and model id's.
ok... so where can i find the vehicleid?
Reply
#4

https://sampwiki.blast.hk/wiki/GetPlayerVehicleID
Reply
#5

PHP код:
//-------------------At the Top of your mode
forward Destroy_NRG(playerid);

//-------------------On OnGameModeInit
new ENrg CreateVehicle(5222493.2388,-1666.8898,12.9077,94.96580060000);

//-------------------On the following publics
public OnPlayerEnterVehicle(playeridvehicleidispassenger)
{
if(
vehicleid == 522 && ispassenger)
    {
        
SetTimerEx("Destroy_NRG"60000false"i"playerid);
        
SendClientMessage(playeridCOLOUR_LIGHTBLUE"You just entered the vehicle 'NRG-500'");
        
SendClientMessage(playeridCOLOUR_RED"This vehicle will dissapear in 60 seconds!");
        return 
1;
    }
    return 
1;
}

public 
OnPlayerExitVehicle(playerid,vehicleid)
{
    if(
vehicleid == 522) return KillTimer(destroy_NRG[playerid]);
    return 
1;
}
//-------------At the End of your mode
public Destroy_NRG(playerid)
{
    
DestroyVehicle(ENrg);
        
KillTimer(destroy_NRG[playerid]);
    return 
1;

Also fixed a few spelling mistakes
Reply
#6

Nice i use the latest PHP code i am go to test thnx!
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)