[Help] Last position -
Glossy42O - 04.11.2014
Hello i have an /afk command and /back command
When i type /afk it sends me to afk zone but in the back command i want when he types it it teleportes him to his last position
Afk code or back code?
Re: [Help] Last position -
Stinged - 04.11.2014
pawn Код:
new Float: gPos[MAX_PLAYERS][3];// Global
CMD:afk(playerid)
{
GetPlayerPos(playerid, gPos[playerid][0], gPos[playerid][1], gPos[playerid][2]);
SetPlayerPos(playerid, ...);
// ...
return 1;
}
CMD:back(playerid)
{
SetPlayerPos(playerid, gPos[playerid][0], gPos[playerid][1], gPos[playerid][2]);
// ...
return 1;
}
Re: [Help] Last position -
Glossy42O - 04.11.2014
Thank you very much stinged.
Repped cause i were looking for it uhhh forever
Re: [Help] Last position -
Glossy42O - 04.11.2014
1 more thing
On afk it's removes his weapons but when he gets back..still no weapons how to get them back?
Re: [Help] Last position -
Banana_Ghost - 04.11.2014
Are you using ResetPlayerWeapons to remove them?
If so, do you save them to their account?
Re: [Help] Last position -
Glossy42O - 04.11.2014
Yeah i do.
And no i do not. Plus i still got no weapons IG cause i will make you have to go to a shop to buy them
Re: [Help] Last position -
Banana_Ghost - 04.11.2014
Im adding on to what he posted above:
pawn Код:
new Float: gPos[MAX_PLAYERS][3];// Global
new weapons[13][2];
CMD:afk(playerid)
{
for (new i = 0; i <= 12; i++)
{
GetPlayerWeaponData(playerid, i, weapons[i][0], weapons[i][1]);
}
ResetPlayerWeapons(playerid);
GetPlayerPos(playerid, gPos[playerid][0], gPos[playerid][1], gPos[playerid][2]);
SetPlayerPos(playerid, ...);
return 1;
}
CMD:back(playerid)
{
SetPlayerPos(playerid, gPos[playerid][0], gPos[playerid][1], gPos[playerid][2]);
for (new i = 0; i <= 12; i++)
{
GivePlayerWeapon(playerid, weapons[i][0], weapons[i][1]);
}
return 1;
}
indention might be off as I just wrote this inside of the window.
Re: [Help] Last position -
DavidBilla - 04.11.2014
pawn Код:
new AWeapons[13][2];
new Float: gPos[MAX_PLAYERS][3];// Global
CMD:afk(playerid)
{
GetPlayerPos(playerid, gPos[playerid][0], gPos[playerid][1], gPos[playerid][2]);
SetPlayerPos(playerid, ...);
for(new i=0;i<=12;i++)
{
GetPlayerWeaponData(playerid,i,AWeapons[i][0],AWeapons[i][1]);
}
ResetPlayerWeapons(playerid);
// ...
return 1;
}
CMD:back(playerid)
{
SetPlayerPos(playerid, gPos[playerid][0], gPos[playerid][1], gPos[playerid][2]);
for(new i=0;i<=12;i++)
{
GivePlayerWeapon(playerid,AWeapons[i][0],AWeapons[i][1]);
}
// ...
return 1;
}
Re: [Help] Last position -
Glossy42O - 04.11.2014
Did i do it correctly ?
PHP код:
CMD:afk(playerid, params[])
{
if(IsPlayerAfk[playerid] == 1) return SendClientMessage(playerid, -1, "{FF0000}[SERVER]{FFFFFF}: You are already AFK");
IsPlayerAfk[playerid] = 1;
for (new i = 0; i <= 12; i++)
{
GetPlayerWeaponData(playerid, i, weapons[i][0], weapons[i][1]);
}
SetPlayerHealth(playerid, 99999999999999999999999999999999999999999999999999999999999.0);
GetPlayerPos(playerid, gPos[playerid][0], gPos[playerid][1], gPos[playerid][2]);
SetPlayerPos(playerid, 1812.0895,-1288.2290,114.9564);
SendClientMessage(playerid, -1, "{00CC00}You have been sent to AFK zone");
SetPlayerVirtualWorld(playerid, 1);
ResetPlayerWeapons(playerid);
return 1;
}
CMD:back(playerid,params[])
{
if(IsPlayerAfk[playerid] == 0) return SendClientMessage(playerid, -1, "{FF0000}[SERVER]{ffffff}: You are not AFK");
if(IsPlayerAfk[playerid] == 1)
{
IsPlayerAfk[playerid] = 0;
for (new i = 0; i <= 12; i++)
{
GivePlayerWeapon(playerid, i, weapons[i][0], weapons[i][1]);
}
SendClientMessage(playerid, -1,"{FF0000}[SERVER]{FFFFFF}: You are back from AFK");
SetPlayerPos(playerid, gPos[playerid][0], gPos[playerid][1], gPos[playerid][2]);
SetPlayerVirtualWorld(playerid, 0);
SetPlayerHealth(playerid, 100);
}
return 1;
}
return 0;
}
Cause i am having two errors
PHP код:
C:\Users\yan\Desktop\Cops And Robbers\gamemodes\LSCNR.pwn(527) : warning 202: number of arguments does not match definition
C:\Users\yan\Desktop\Cops And Robbers\gamemodes\LSCNR.pwn(536) : error 010: invalid function or declaration
Pawn compiler 3.2.3664 Copyright (c) 1997-2006, ITB CompuPhase
1 Error.
Line
PHP код:
GivePlayerWeapon(playerid, i, weapons[i][0], weapons[i][1]);
Re: [Help] Last position -
Banana_Ghost - 04.11.2014
remove the return 0 and the } then try it
EDIT: GivePlayerWeapon(playerid, weapons[i][0], weapons[i][1]);
use that for GivePlayerWeapon