No commands working after respawning -
kampuman - 20.07.2016
Guys I need your help. I made a DM match. What happened was when you got killed in that map you'll respawn again to that same DM area, which is correct but the next thing was after respawning in that area again, now I can't able to use any commands. no error notes, no error warning from console or ingame. But I can type and send anything without using
/
whole script for onplayerspawn
http://pastebin.com/sFcE9ebP
OnPlayerSpawn
PHP код:
public OnPlayerSpawn( playerid )
{
if(GetPVarInt(playerid,"WarDM"))
{
new RandomDM = random(sizeof(RandomSpawnWarDM));
SetPlayerPos(playerid, RandomSpawnWarDM[RandomDM][0], RandomSpawnWarDM[RandomDM][1], RandomSpawnWarDM[RandomDM][2]);
SetPlayerFacingAngle(playerid, RandomSpawnWarDM[RandomDM][3]);
SetCameraBehindPlayer(playerid);
SetPlayerHealth(playerid, 100);
SetPlayerArmour(playerid, 0);
SetPlayerVirtualWorld(playerid, 18);
SetPlayerInterior(playerid, 0);
SaveWeapons(playerid);
ResetPlayerWeapons(playerid); //must be added before this
GivePlayerWeapon(playerid, 1, 1);
GivePlayerWeapon(playerid, 42, 100000);
GivePlayerWeapon(playerid, 22, 100000);
GivePlayerWeapon(playerid, 26, 100000);
GivePlayerWeapon(playerid, 28, 100000);
GivePlayerWeapon(playerid, 31, 100000);
GivePlayerWeapon(playerid, 33, 100000);
IsPlayerInDM[playerid] = 1;
pInEvent[playerid] = 1;
SetPVarInt(playerid, "CMDDisabled", 1);
SetPVarInt(playerid,"WarDM",true);
}
This is the command for teleporing to that DM Area
PHP код:
CMD:war(playerid, params[])
{
if(GetPVarInt(playerid, "CMDDisabled") != 0)
{
ShowPlayerDialog(playerid, DIALOG_EVADE, DIALOG_STYLE_MSGBOX, "Leave Menu", "You must Leave first before using this command", "Leave", "Cancel");
return 1;
}
if ( PlayerInfo[ playerid ][ GodMode ] == 1) //god mode set .. lets unset it
{
SetPlayerHealth(playerid, 100.0); //set health to 100
PlayerInfo[ playerid ][ GodMode ] = 0; //set godmode to false
}
new string[128], pName[MAX_PLAYER_NAME];
GetPlayerName(playerid, pName, MAX_PLAYER_NAME);
format(string, sizeof(string), "{6666FF}(/war) {00CCFF}%s {6666FF}has Teleported to Total War Deathmatch",pName);
SendClientMessageToAll(0xFFFFFFFF, string);
SetPlayerTime( playerid, 0, 0 );
GameTextForPlayer(playerid,"~y~Welcome to ~n~~b~Total War",2000,3);
SetPlayerHealth(playerid, 100);
SetPlayerArmour(playerid, 0);
SetCameraBehindPlayer(playerid);
SetPlayerVirtualWorld(playerid, 18);
SetPlayerInterior(playerid, 0);
SaveWeapons(playerid);
ResetPlayerWeapons(playerid); //must be added before this
GivePlayerWeapon(playerid, 1, 1);
GivePlayerWeapon(playerid, 42, 10100);
GivePlayerWeapon(playerid, 22, 10100);
GivePlayerWeapon(playerid, 26, 10100);
GivePlayerWeapon(playerid, 28, 10100);
GivePlayerWeapon(playerid, 31, 10100);
GivePlayerWeapon(playerid, 33, 10100);
DestroyVehicle(GetPlayerVehicleID(playerid));
new RandomDM = random(sizeof(RandomSpawnWarDM));
SetPlayerPos(playerid, RandomSpawnWarDM[RandomDM][0], RandomSpawnWarDM[RandomDM][1], RandomSpawnWarDM[RandomDM][2]);
SetPlayerFacingAngle(playerid, RandomSpawnWarDM[RandomDM][3]);
IsPlayerInDM[playerid] = 1;
pInEvent[playerid] = 1;
SetPVarInt(playerid,"WarDM",true);
SetPVarInt(playerid, "CMDDisabled", 1); // Toggle Go's Disabled // Show Player is in DM/RACE
return 1;
}
and This is for the Dialog Evade which will delete the Pvar
PHP код:
if(dialogid == DIALOG_EVADE)
{
if(response) // If they clicked 'Yes' or pressed enter
{
SpawnPlayer(playerid);
DeletePVar(playerid,"WarDM");
}
else // Pressed ESC or clicked cancel
{
}
return 1; // We handled a dialog, so return 1. Just like OnPlayerCommandText.
}
Re: No commands working after respawning -
SickAttack - 20.07.2016
SetPVarInt(playerid, "CMDDisabled", 0);
Re: No commands working after respawning -
kampuman - 20.07.2016
@SickAttack thanks for the help tho/
FIXED: This line
if(GetPVarInt(playerid,"cantusecmds")) DeletePVar(playerid,"cantusecmds");
is calling from OnPlayerDeath. I had to remove all cantusecmds.