PDA

View Full Version : Firework system


kamiliuxliuxliux
15/08/2014, 09:00 PM
Hello, I've created new firework system and when player types /fw a timer starts... Everything is below.

CMD:fw(playerid)
{
PutFW(playerid, 1) // stock is below
return 1;
}

stock PutFW(playerid, fwid)
{
if(fwInfo[playerid][fwid-1][able] == 1)
{
fwInfo[playerid][fwid-1][able] = 0;
new Float:fd[3];
GetPlayerPos(playerid, fd[0],fd[1],fd[2]);
SetTimerEx("FW",5000,false,"iiifff",playerid,fwid,0,fd[0],fd[1],fd[2]); // a timer starts for 5 seconds
fwInfo[playerid][fwid-1][obj_id] = CreateObject(1252,fd[0],fd[1],fd[2],0,0,0);
SCM(playerid, COLOR_WHITE, " * You've put a dynamite!");
}
return 1;
}

public FW(playerid, fwid,cnt,Float:x,Float:y,Float:z) // public FW function
{
if(fwid == 1)
{
if(cnt == 0) {
GetObjectPos(fwInfo[playerid][fwid-1][obj_id],x,y,z); // here I want to change public's parameters x,y and z, but it's not changing.
DestroyObject(fwInfo[playerid][fwid-1][obj_id]); }
if(cnt == 0 || (cnt > 0 && cnt < 50)) {CreateExplosion(x,y,z,12,5.0); SetTimerEx("FW",200,false,"iiifff",playerid,fwid,cnt+1,x,y,z);}
else if(cnt == 50)
{
fwInfo[playerid][fwid-1][able] = 1;
fwInfo[playerid][fwid-1][obj_id] = -1;
}
}
return 1;
}

So is there any ways to change the value of public parameters?

kamiliuxliuxliux
15/08/2014, 10:25 PM
Anyone?

ThePhenix
15/08/2014, 10:44 PM
What do you exactly mean by changing the value of public functions?
You can make an optional parameter by designing a default value to a certain parameter.