Need some help with the timer -
Don_Cage - 18.03.2013
Ok, so i did like this
pawn Код:
if(strcmp(cmd, "/loadarmory", true) == 0)
{
if(PlayerInfo[playerid][pJob] == 16)
{
if(PlayerInfo[playerid][pArmoryrefill] == 0)
{
new tmpcar = GetPlayerVehicleID(playerid);
if(IsPlayerInRangeOfPoint(playerid, 15, -65.3189,-1119.7914,1.0781))
{
if(GetVehicleModel(tmpcar) == 433 || GetVehicleModel(tmpcar) == 440 || GetVehicleModel(tmpcar) == 514 || GetVehicleModel(tmpcar) == 428 || GetVehicleModel(tmpcar) == 403 || GetVehicleModel(tmpcar) == 515)
{
SendClientMessage(playerid, TEAM_GROVE_COLOR, "You have loaded your truck with armory equipment!");
SendClientMessage(playerid, TEAM_AZTECAS_COLOR, "* The Government have paid the bill for loading armory equipment.");
PlayerInfo[playerid][pArmoryrefill] = 1;
RemoveObject(TemporaryArmoryCrateSF);
SetTimerEx("CreateDynamicObject",30*1000,false,"d",TemporaryArmoryCrateSF);
}
else
{
SendClientMessage(playerid, COLOR_GREY, "You can't load with this vehicle!");
}
}
else
{
SendClientMessage(playerid, COLOR_GREY, "You are NOT at the Armory loading place!");
}
}
else
{
SendClientMessage(playerid, COLOR_GREY, "You are already loaded.");
}
}
else
{
SendClientMessage(playerid, COLOR_GREY, "You are not a Trucker!");
}
return 1;
}
but i got some problem with it. I get no error when i complie and it removes the object but it dont spawn back.
I proberbly did wrong since its my first try on this but hey, you learn from misstakes right? so can i do like this?
pawn Код:
RemoveObject(TemporaryArmoryCrateSF);
SetTimerEx("CreateDynamicObject",30*1000,false,"d",TemporaryArmoryCrateSF);
i have no public or forward for the "CreateDynamicObject" cuz i didnt think that was needed since i use it for the other objects and they work fine but i might was wrong?
Re: Need some help with the timer -
CBCandyBoy - 18.03.2013
you need to make one forward like
forward createdynamicobject()
and then public
Re: Need some help with the timer -
Don_Cage - 18.03.2013
but how do i make the public then? i mean i use CreateDynamicObject for all other objects that i have IG and they work fine without that public. But do i just do like this?
pawn Код:
forward CreateDynamicObject(objectid);
public CreateDynamicObject(objectid)
{
if(IsValidDynamicObject(objectid))
CreateDynamicObject(objectid);
return 1;
}
Re: Need some help with the timer -
CBCandyBoy - 18.03.2013
man i have for cars but i dont know for object
pawn Код:
#define MAX_CUSTOM_VEHICLES 5
new CustomVehicles[MAX_CUSTOM_VEHICLES];
//(...)
CustomVehicles[0] = CreateVehicle(541, 300.2742, 1863.9669, 17.2396, 0.0000, -1, -1, 100);
//(...)
public OnPlayerStateChange(playerid, newstate, oldstate) {
if(newstate & PLAYER_STATE_DRIVER) {
new vid = GetPlayerVehicleID(playerid), Float:p[4];
for(new i = 0; i != MAX_CUSTOM_VEHICLES; ++i) { //Alternatively use iterator
if(CustomVehicles[i] == vid) {
GetVehiclePos(vid, p[0], p[1], p[2]);
GetVehicleZAngle(vid, p[3]);
new model = GetVehicleModel(vid);
SetTimerEx("RebuildCar", 2000, 0, "iiiffff", playerid, i, model, p[0], p[1], p[2], p[3]);
}
}
}
return 1;
}
forward RebuildCar(pid, vehi, model, Float:x, Float:y, Float:z, Float:r);
public RebuildCar(pid, vehi, model, Float:x, Float:y, Float:z, Float:r) {
CustomVehicles[vehi] = CreateVehicle(model, x, y, z, r, -1, -1, 0);
return 1;
}
Re: Need some help with the timer -
Don_Cage - 18.03.2013
I tried on my way and i got error that it was allready defined but i cant find it anywhere in the script that its defined, cant find stock,public or anything. only CreateDynamicObject i can find is those objects that i created
Re: Need some help with the timer -
CBCandyBoy - 18.03.2013
show the error
Re: Need some help with the timer -
Don_Cage - 18.03.2013
pawn Код:
C:\Users\new account\Desktop\Script\gamemodes\Script.pwn(2955) : error 021: symbol already defined: "CreateDynamicObject"
C:\Users\new account\Desktop\Script\gamemodes\Script.pwn(2956) : error 021: symbol already defined: "CreateDynamicObject"
C:\Users\new account\Desktop\Script\gamemodes\Script.pwn(2959) : error 010: invalid function or declaration
C:\Users\new account\Desktop\Script\gamemodes\Script.pwn(2962) : error 010: invalid function or declaration
Pawn compiler 3.2.3664 Copyright (c) 1997-2006, ITB CompuPhase
4 Errors.
on this
pawn Код:
forward CreateDynamicObject(objectid);
public CreateDynamicObject(objectid)
{
if(IsValidDynamicObject(objectid))
CreateDynamicObject(objectid);
return 1;
}
Re: Need some help with the timer -
CBCandyBoy - 18.03.2013
man change that settimerex("Createdynamicobject" to some thing else like SetTimerEX("myobject"
and those forward and public also
Re: Need some help with the timer -
Don_Cage - 18.03.2013
You mean like this?
pawn Код:
forward ReSpawnObject(objectid);
public ReSpawnObject(objectid)
{
if(IsValidDynamicObject(objectid))
ReSpawnObject(objectid);
return 1;
}
Re: Need some help with the timer -
CBCandyBoy - 18.03.2013
Yes like that only