No commands working after respawning
#1

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 OnPlayerSpawnplayerid )
{
    if(
GetPVarInt(playerid,"WarDM"))
    {
        new 
RandomDM random(sizeof(RandomSpawnWarDM));
        
SetPlayerPos(playeridRandomSpawnWarDM[RandomDM][0], RandomSpawnWarDM[RandomDM][1], RandomSpawnWarDM[RandomDM][2]);
        
SetPlayerFacingAngle(playeridRandomSpawnWarDM[RandomDM][3]);
           
SetCameraBehindPlayer(playerid);
        
SetPlayerHealth(playerid100);
        
SetPlayerArmour(playerid0);
        
SetPlayerVirtualWorld(playerid18);
        
SetPlayerInterior(playerid0);
        
SaveWeapons(playerid);
        
ResetPlayerWeapons(playerid); //must be added before this
        
GivePlayerWeapon(playerid11);
        
GivePlayerWeapon(playerid42100000);
        
GivePlayerWeapon(playerid22100000);
        
GivePlayerWeapon(playerid26100000);
        
GivePlayerWeapon(playerid28100000);
        
GivePlayerWeapon(playerid31100000);
        
GivePlayerWeapon(playerid33100000);
        
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(playeridparams[])
{
    if(
GetPVarInt(playerid"CMDDisabled") != 0)
     {
        
ShowPlayerDialog(playeridDIALOG_EVADEDIALOG_STYLE_MSGBOX"Leave Menu""You must Leave first before using this command""Leave""Cancel");
        return 
1;
    }
    if ( 
PlayerInfoplayerid ][ GodMode ] == 1//god mode set .. lets unset it
    
{
        
SetPlayerHealth(playerid100.0);    //set health to 100
        
PlayerInfoplayerid ][ GodMode ] = 0;    //set godmode to false
    
}
    new 
string[128], pName[MAX_PLAYER_NAME];
    
GetPlayerName(playeridpNameMAX_PLAYER_NAME);
    
format(stringsizeof(string), "{6666FF}(/war) {00CCFF}%s {6666FF}has Teleported to Total War Deathmatch",pName);
    
SendClientMessageToAll(0xFFFFFFFFstring);
    
SetPlayerTimeplayerid0);
    
GameTextForPlayer(playerid,"~y~Welcome to ~n~~b~Total War",2000,3);
    
SetPlayerHealth(playerid100);
    
SetPlayerArmour(playerid0);
    
SetCameraBehindPlayer(playerid);
       
SetPlayerVirtualWorld(playerid18);
       
SetPlayerInterior(playerid0);
       
SaveWeapons(playerid);
    
ResetPlayerWeapons(playerid); //must be added before this
    
GivePlayerWeapon(playerid11);
    
GivePlayerWeapon(playerid4210100);
    
GivePlayerWeapon(playerid2210100);
    
GivePlayerWeapon(playerid2610100);
    
GivePlayerWeapon(playerid2810100);
    
GivePlayerWeapon(playerid3110100);
    
GivePlayerWeapon(playerid3310100);
    
DestroyVehicle(GetPlayerVehicleID(playerid));
       new 
RandomDM random(sizeof(RandomSpawnWarDM));
    
SetPlayerPos(playeridRandomSpawnWarDM[RandomDM][0], RandomSpawnWarDM[RandomDM][1], RandomSpawnWarDM[RandomDM][2]);
    
SetPlayerFacingAngle(playeridRandomSpawnWarDM[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.
    

Reply
#2

SetPVarInt(playerid, "CMDDisabled", 0);
Reply
#3

@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.
Reply


Forum Jump:


Users browsing this thread: 2 Guest(s)