Help me! -
zofa - 08.11.2008
hello to everyone, I have created a script but works only for the player with id 0, why?
here's the script:
on top:
new BOOM[MAX_PLAYERS];
ongamemode:
SetTimer("killcar", 1000, 1);
onplayercommandtext:
if (strcmp("/boom", cmdtext, true, 10) == 0)
{
BOOM[playerid] = 1;
SendClientMessage(playerid, GREEN, "Per disattivare il comando /boff");
return 1;
}
if(strcmp(cmdtext,"/boff",true)==0)
{
BOOM[playerid] = 0;
SendClientMessage(id, yellow, "Comando disattivato");
return 1;
}
at the end:
forward killcar(playerid);
public killcar(playerid)
{
if(BOOM[playerid] == 1)
{
SetVehicleHealth(GetPlayerVehicleID(playerid) ,3);
SetTimer("killcar2", 4000, 1);
return 1;
}
}
forward killcar2(playerid);
public killcar2(playerid)
{
SetVehicleHealth(GetPlayerVehicleID(playerid) ,1000);
SetTimer("killcar", 1000, 1);
return 1;
}
sorry for English disgusting but I use the translator of ******, I am Italian XD
Re: Help me! -
pspleo - 08.11.2008
SetTimer("killcar", 1000, 1); //you don't use playerid here but...
public killcar(playerid) //...you use it here...
for(new i = 0; i < GetMaxPlayers(); i++) //...so you need a loop...
if(BOOM[i] == 1) //..and check...
//the rest of your code here with "i" as playerid.
Re: Help me! -
zofa - 08.11.2008
thanks it works!
Re: Help me! -
Audi_Quattrix - 17.06.2012
First Scriting Discussion thread