SA-MP Forums Archive
what's wrong with it? - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+---- Forum: Help Archive (https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: what's wrong with it? (/showthread.php?tid=250176)



what's wrong with it? - omer5198 - 22.04.2011

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);



Re: what's wrong with it? - Vince - 22.04.2011

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


Re: what's wrong with it? - omer5198 - 22.04.2011

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?


Re: what's wrong with it? - linuxthefish - 22.04.2011

https://sampwiki.blast.hk/wiki/GetPlayerVehicleID


Re: what's wrong with it? - nuriel8833 - 22.04.2011

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


Re: what's wrong with it? - [ADC]Aldi96 - 22.04.2011

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