SA-MP Forums Archive
god help - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+---- Forum: Help Archive (https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: god help (/showthread.php?tid=75081)



god help - aaronishello - 28.04.2009

i make godmode command like this

at the top

pawn Код:
new Godmode[MAX_PLAYERS];
new GodTimer;
forward GodMode(playerid);
then i have
pawn Код:
public OnPlayerCommandText(playerid, cmdtext[])
{
    if (strcmp("/GodMode", cmdtext, true, 10) == 0)
    {
        if(Godmode[playerid] == 0)
        {
        SendClientMessage(playerid, COLOR_GREEN, "Godmode On");
        Godmode[playerid] = 1;
        GodTimer = SetTimer("GodMode", 100, 1);
        }
        else if(Godmode[playerid] == 1)
        {
        SendClientMessage(playerid, COLOR_YELLOW, "god off");
        KillTimer(GodTimer);
 }
        return 1;
    }
    return 0;
}

public GodMode(playerid)
{
    SetPlayerHealth(playerid, 1000.0);
    ResetPlayerWeapons(playerid);
    return 1;
}
but i screw up and it is ALWAYS on so can any one please help fix me it thanks.


Re: god help - miokie - 28.04.2009

if (strcmp("/GodMode", cmdtext, true, 10) == 0)
{
if(Godmode[playerid] == 1)
{
SendClientMessage(playerid, COLOR_GREEN, "Godmode On");
Godmode[playerid] = 1;
GodTimer = SetTimer("GodMode", 100, 1);
}
else if(Godmode[playerid] == 0)
{
SendClientMessage(playerid, COLOR_YELLOW, "god off");
KillTimer(GodTimer);
}
return 1;
}
return 0;
}


Re: god help - Diler - 28.04.2009

Код:
public OnPlayerCommandText(playerid, cmdtext[])
{
	if (strcmp("/GodMode", cmdtext, true, 10) == 0)
	{
		if(Godmode[playerid] == 0)
		{
		SendClientMessage(playerid, COLOR_GREEN, "Godmode On");
		Godmode[playerid] = 1;
		GodTimer = SetTimer("GodMode", 100, 1);
		}
		else if(Godmode[playerid] == 1)
		{
		SendClientMessage(playerid, COLOR_YELLOW, "god off");
        Godmode[playerid]=0;
 }
		return 1;
	}
	return 0;
}
public GodMode(playerid)
{
if(Godmode[playerid]==1){
	SetPlayerHealth(playerid, 1000.0);
	ResetPlayerWeapons(playerid);
}
	return 1;
}



Re: god help - Metorea - 28.04.2009

No, they wont work but this should:

At The Top:

pawn Код:
forward GodMode(playerid);

new GodModeActive[MAX_PLAYERS];
new GodTimer;
Then This:

pawn Код:
public OnPlayerCommandText(playerid, cmdtext[])
{
  if (strcmp("/GodMode", cmdtext, true, 10) == 0)
  {
   if(GodModeActive[playerid] == 0)
   {
   SendClientMessage(playerid, COLOR_GREEN, "Godmode On");
   GodModeActive[playerid] = 1;
   SetTimer("GodMode", 100, 1);
   }
   else if(GodModeActive[playerid] == 1)
   {
   GodModeActive[playerid] = 0;
   SendClientMessage(playerid, COLOR_YELLOW, "god off");
   KillTimer(GodTimer);
 }
   return 1;
  }
  return 0;
}

public GodMode(playerid)
{
    SetPlayerHealth(playerid, 1000.0);
    ResetPlayerWeapons(playerid);
    return 1;
}
That should work.



Re: god help - aaronishello - 28.04.2009

hey meturea that work thanks bro! and thank others anyway


Re: god help - Metorea - 28.04.2009

Quote:
Originally Posted by aaronishello
hey meturea that work thanks bro! and thank others anyway
Glad to hear it, and its Metorea not meturea