Restoring last positions -
Digii - 09.06.2016
Hello Sa-Mp Brothers, I have a bit of a problem with my re-spawn command.
I want to do the thing when I spawn a player to restore his last position but I did not succeed
can you bros help me with this command so sort it out Please
?
here is my command:
Код:
CMD:spawn(playerid, params[])
{
if(gPlayerLogged[playerid] == 0) return SendClientMessage(playerid, COLOR_LIGHTRED, "You need to login first.");
if(IsPlayerConnected(playerid))
{
if (PlayerInfo[playerid][pAdmin] >= 1)
{
new id,sendername[30],giveplayer[30],string[256];
if(sscanf(params, "u", id)) return SCM(playerid,COLOR_WHITE,"{FF9900}Scrie: {cef0ac}/spawn <Name/Playerid>");
{
if(IsPlayerConnected(id))
{
if(id != INVALID_PLAYER_ID)
{
GetPlayerName(id, giveplayer, sizeof(giveplayer));
SpawnPlayer(id);
GetPlayerName(playerid, sendername, sizeof(sendername));
format(string, sizeof(string), "* Admin %s has spawn-ed you.", sendername);
SendClientMessage(id, COLOR_IN2, string);
format(string, sizeof(string), "You have respawned %s.", giveplayer);
SendClientMessage(playerid, COLOR_IN2, string);
format(string, sizeof(string), "AdmCmd: %s has /spawn-ed %s.",sendername, giveplayer);
ABroadCast(COLOR_ADMCMD,string,1);
HLChat(COLOR_ADMCMD,string);
return 1;
}
}
else
{
SCM(playerid,COLOR_WHITE,"{FFFFCC}Error: Player not connected.");
}
}
}
else
{
SendClientMessage(playerid, COLOR_ERROR, AdminOnly);
}
}
return 1;
}
Re: Restoring last positions -
SyS - 09.06.2016
what is problem ? give more detail and what are you expecting to do with this command which last postion u want?
Re: Restoring last positions -
Digii - 09.06.2016
For example x got stuck, when I'm using /spawn the player should respawn and then restore his last position before getting stuck
Re: Restoring last positions -
SyS - 09.06.2016
just raise the z axis a little bit
like
PHP код:
CMD:spawn(playerid, params[])
{
if(gPlayerLogged[playerid] == 0) return SendClientMessage(playerid, COLOR_LIGHTRED, "You need to login first.");
if(IsPlayerConnected(playerid))
{
if (PlayerInfo[playerid][pAdmin] >= 1)
{
new id,sendername[30],giveplayer[30],string[256];
if(sscanf(params, "u", id)) return SCM(playerid,COLOR_WHITE,"{FF9900}Scrie: {cef0ac}/spawn <Name/Playerid>");
{
if(IsPlayerConnected(id))
{
if(id != INVALID_PLAYER_ID)
{
GetPlayerName(id, giveplayer, sizeof(giveplayer));
GetPlayerPos(id, x, y, z);
SetPlayerPos(id, x, y, z+5);
GetPlayerName(playerid, sendername, sizeof(sendername));
format(string, sizeof(string), "* Admin %s has spawn-ed you.", sendername);
SendClientMessage(id, COLOR_IN2, string);
format(string, sizeof(string), "You have respawned %s.", giveplayer);
SendClientMessage(playerid, COLOR_IN2, string);
format(string, sizeof(string), "AdmCmd: %s has /spawn-ed %s.",sendername, giveplayer);
ABroadCast(COLOR_ADMCMD,string,1);
HLChat(COLOR_ADMCMD,string);
return 1;
}
}
else
{
SCM(playerid,COLOR_WHITE,"{FFFFCC}Error: Player not connected.");
}
}
}
else
{
SendClientMessage(playerid, COLOR_ERROR, AdminOnly);
}
}
return 1;
}
Try it
Re: Restoring last positions -
Digii - 09.06.2016
I get this errors:
C:\Users\SYSTEM32\GMRPG\gamemodes\MDG.pwn(26667) : error 017: undefined symbol "x"
C:\Users\SYSTEM32\GMRPG\gamemodes\MDG.pwn(2666
: error 017: undefined symbol "x"
Re: Restoring last positions -
justjamie - 09.06.2016
PHP код:
CMD:spawn(playerid, params[])
{
if(gPlayerLogged[playerid] == 0) return SendClientMessage(playerid, COLOR_LIGHTRED, "You need to login first.");
if(IsPlayerConnected(playerid))
{
if (PlayerInfo[playerid][pAdmin] >= 1)
{
new id,sendername[30],giveplayer[30],string[256];
if(sscanf(params, "u", id)) return SCM(playerid,COLOR_WHITE,"{FF9900}Scrie: {cef0ac}/spawn <Name/Playerid>");
{
if(IsPlayerConnected(id))
{
if(id != INVALID_PLAYER_ID)
{
new float:x,float:y,float:z;
GetPlayerName(id, giveplayer, sizeof(giveplayer));
GetPlayerPos(id, x, y, z);
SetPlayerPos(id, x, y, z+5);
GetPlayerName(playerid, sendername, sizeof(sendername));
format(string, sizeof(string), "* Admin %s has spawn-ed you.", sendername);
SendClientMessage(id, COLOR_IN2, string);
format(string, sizeof(string), "You have respawned %s.", giveplayer);
SendClientMessage(playerid, COLOR_IN2, string);
format(string, sizeof(string), "AdmCmd: %s has /spawn-ed %s.",sendername, giveplayer);
ABroadCast(COLOR_ADMCMD,string,1);
HLChat(COLOR_ADMCMD,string);
return 1;
}
}
else
{
SCM(playerid,COLOR_WHITE,"{FFFFCC}Error: Player not connected.");
}
}
}
else
{
SendClientMessage(playerid, COLOR_ERROR, AdminOnly);
}
}
return 1;
}
he forgot to define the floats
Re: Restoring last positions -
Digii - 09.06.2016
And again another 7 warnings
sorry brothers for making you think and kill your nerves with my stupid command
Код:
C:\Users\SYSTEM32\GMRPG\gamemodes\MDG.pwn(26668) : warning 213: tag mismatch
C:\Users\SYSTEM32\GMRPG\gamemodes\MDG.pwn(26668) : warning 213: tag mismatch
C:\Users\SYSTEM32\GMRPG\gamemodes\MDG.pwn(26668) : warning 213: tag mismatch
C:\Users\SYSTEM32\GMRPG\gamemodes\MDG.pwn(26669) : warning 213: tag mismatch
C:\Users\SYSTEM32\GMRPG\gamemodes\MDG.pwn(26669) : warning 213: tag mismatch
C:\Users\SYSTEM32\GMRPG\gamemodes\MDG.pwn(26669) : warning 213: tag mismatch
C:\Users\SYSTEM32\GMRPG\gamemodes\MDG.pwn(26687) : warning 217: loose indentation
Here are lines:
Код:
(26668) GetPlayerPos(id, x, y, z);
Код:
(26669) SetPlayerPos(id, x, y, z+5);
Код:
(26687) else
{
SendClientMessage(playerid, COLOR_ERROR, AdminOnly);
}
}
return 1;
}
Re: Restoring last positions -
Digii - 11.06.2016
Anyone?
Re: Restoring last positions -
SyS - 11.06.2016
Quote:
Originally Posted by Digii
Anyone?
|
sorry i forgot the declaration and justjamie did float: i think its Float:
like this
PHP код:
CMD:spawn(playerid, params[])
{
if(gPlayerLogged[playerid] == 0) return SendClientMessage(playerid, COLOR_LIGHTRED, "You need to login first.");
if(IsPlayerConnected(playerid))
{
if (PlayerInfo[playerid][pAdmin] >= 1)
{
new id,sendername[30],giveplayer[30],string[256];
if(sscanf(params, "u", id)) return SCM(playerid,COLOR_WHITE,"{FF9900}Scrie: {cef0ac}/spawn <Name/Playerid>");
{
if(IsPlayerConnected(id))
{
if(id != INVALID_PLAYER_ID)
{
new Float:x,Float:y,Float:z;
GetPlayerName(id, giveplayer, sizeof(giveplayer));
GetPlayerPos(id, x, y, z);
SetPlayerPos(id, x, y, z+5);
GetPlayerName(playerid, sendername, sizeof(sendername));
format(string, sizeof(string), "* Admin %s has spawn-ed you.", sendername);
SendClientMessage(id, COLOR_IN2, string);
format(string, sizeof(string), "You have respawned %s.", giveplayer);
SendClientMessage(playerid, COLOR_IN2, string);
format(string, sizeof(string), "AdmCmd: %s has /spawn-ed %s.",sendername, giveplayer);
ABroadCast(COLOR_ADMCMD,string,1);
HLChat(COLOR_ADMCMD,string);
return 1;
}
}
else
{
SCM(playerid,COLOR_WHITE,"{FFFFCC}Error: Player not connected.");
}
}
}
else
{
SendClientMessage(playerid, COLOR_ERROR, AdminOnly);
}
}
return 1;
}
Re: Restoring last positions -
Digii - 12.06.2016
Thank you Sreyas very much , thank all of you bros again <3.