11.05.2013, 19:56
I have a command to save (/sloc) and load (/lloc) player position, i tried to save the current vehicle position when using /sloc and spawning the vehicle back with /lloc, but i get an error. Here are the 2 cmds:
(6645) : error 017: undefined symbol "currentveh"
Line 6645:
Thanks.
pawn Код:
CMD:sloc(playerid, params[])
{
if(pInfo[playerid][Logged] == 0) return SCM(playerid,0x0080C0FF,"Please login before using this command.");
if(pInfo[playerid][Admin] >= 3)
{
if(Saved[playerid] == 0)
{
Saved[playerid] = 1;
}
new Float:xpoz,Float:ypoz,Float:zpoz;
GetPlayerPos(playerid,xpoz,ypoz,zpoz);
new currentveh;
currentveh = GetPlayerVehicleID(playerid);
new Float:vxpoz,Float:vypoz,Float:vzpoz;
GetVehiclePos(currentveh,vxpoz,vypoz,vzpoz);
new aName[24];
GetPlayerName(playerid,aName,128);
SetPVarFloat(playerid,"XPos",xpoz); SetPVarFloat(playerid,"YPos",ypoz); SetPVarFloat(playerid,"ZPos",zpoz);
SetPVarFloat(playerid,"VXPos",vxpoz); SetPVarFloat(playerid,"VYPos",vypoz); SetPVarFloat(playerid,"VZPos",vzpoz);
SCM(playerid, pink, "You have saved your position, now type /lloc to go back there.");
new msg[170];
format(msg, sizeof(msg), "0,4** Admin %s (%d) has saved his coordinates: %f,%f,%f - using /sloc.", aName,playerid,xpoz,ypoz,zpoz);
IRC_GroupSay(gGroupID, IRC_ACHANNEL, msg);
IRC_GroupSay(gGroupID, IRC_CHANNEL, msg);
}
return 1;
}
CMD:lloc(playerid, params[])
{
if(pInfo[playerid][Logged] == 0) return SCM(playerid,0x0080C0FF,"Please login before using this command.");
if(pInfo[playerid][Admin] >= 3)
{
if(Saved[playerid] == 1)
{
new aName[24];
GetPlayerName(playerid,aName,128);
SetPlayerPosEx(playerid, GetPVarFloat(playerid,"XPos"), GetPVarFloat(playerid,"YPos"), GetPVarFloat(playerid,"ZPos"));
SetVehiclePos(currentveh, GetPVarFloat(playerid,"VXPos"), GetPVarFloat(playerid,"VYPos"), GetPVarFloat(playerid,"VZPos"));
SCM(playerid, pink, "You have teleported to your last saved position.");
}
else SCM(playerid, pink, "You didn't save your position! Please type /sloc again.");
}
return true;
}
Line 6645:
pawn Код:
SetVehiclePos(currentveh, GetPVarFloat(playerid,"VXPos"), GetPVarFloat(playerid,"VYPos"), GetPVarFloat(playerid,"VZPos"));