Help me!
#1


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

Reply
#2

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.
Reply
#3

thanks it works!
Reply
#4

First Scriting Discussion thread
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)