Need help with /repair command. -
Gytis0 - 13.04.2012
I made a /repair command in a filterscript and I need help integrating PlayerInfo from my GameMode to the filterscript. You'll get the point when you see the codes.
So here's the command:
pawn Код:
CMD:repair(playerid, params[])
{
new vehicleid;
vehicleid = GetClosestVehicle(playerid);
if(PlayerToVehicle(playerid, vehicleid, 3.0))
{
SetVehicleHealth(vehicleid, 1000.0);
SendClientMessage(playerid, COLOR_WHITE, "You have fully repaired the engine.");
SendClientMessage(playerid, COLOR_WHITE, "{CC3333}NOTICE:{ffffff} You haven't received any payment for your work. Ask the other player to pay you.");
}
}
And what I need to do, is integrate this in to my command:
pawn Код:
if(PlayerInfo[playerid][pJob] == 1)
Once again, the command is in a filterscript and the "PlayerInfo" is in the GameMode.
Re: Need help with /repair command. -
ReneG - 13.04.2012
Command needs to be in the gamemode, or else you'll get undefined symbol errors.
pawn Код:
CMD:repair(playerid, params[])
{
if(PlayerInfo[playerid][pJob] == 1) // Learn how to use if statements
{
new vehicleid;
vehicleid = GetClosestVehicle(playerid);
if(PlayerToVehicle(playerid, vehicleid, 3.0))
{
SetVehicleHealth(vehicleid, 1000.0);
SendClientMessage(playerid, COLOR_WHITE, "You have fully repaired the engine.");
SendClientMessage(playerid, COLOR_WHITE, "{CC3333}NOTICE:{ffffff} You haven't received any payment for your work. Ask the other player to pay you.");
return 1;
}
else return SendClientMessage(playerid, COLOR_WHITE, "You are not near a vehicle!");
}
else return SendClientMessage(playerid, COLOR_WHITE, "You are not a mechanic!");
}
Re: Need help with /repair command. -
Gytis0 - 13.04.2012
Quote:
Originally Posted by VincentDunn
Command needs to be in the gamemode, or else you'll get undefined symbol errors.
pawn Код:
CMD:repair(playerid, params[]) { if(PlayerInfo[playerid][pJob] == 1) // Learn how to use if statements { new vehicleid; vehicleid = GetClosestVehicle(playerid); if(PlayerToVehicle(playerid, vehicleid, 3.0)) { SetVehicleHealth(vehicleid, 1000.0); SendClientMessage(playerid, COLOR_WHITE, "You have fully repaired the engine."); SendClientMessage(playerid, COLOR_WHITE, "{CC3333}NOTICE:{ffffff} You haven't received any payment for your work. Ask the other player to pay you."); return 1; } else return SendClientMessage(playerid, COLOR_WHITE, "You are not near a vehicle!"); } else return SendClientMessage(playerid, COLOR_WHITE, "You are not a mechanic!"); }
|
Yeah, I wish that it would've been that simple. The thing is, the functions "GetClosestVehicle" and "PlayerToVehicle" are in the filterscript and I don't know how to move them to my GameMode. If it would've been a simple command like this, I wouldn't've started a thread in the first place. What I need is, I need something to call the PlayerInfo thingy, is that possible?
Re: Need help with /repair command. -
ReneG - 13.04.2012
If you define a new enum for the filterscript. The gamemode variables will mix up. Just move the functions. It's not that hard copying/pasting a function into your gamemode.
Re: Need help with /repair command. -
Gytis0 - 13.04.2012
Quote:
Originally Posted by VincentDunn
If you define a new enum for the filterscript. The gamemode variables will mix up. Just move the functions. It's not that hard copying/pasting a function into your gamemode.
|
WTF!? Previously when I copied the functions, the command didn't work, but now it works. Oh well. Thanks man. +rep