SA-MP Forums Archive
Command only when 1 Score? - 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: Command only when 1 Score? (/showthread.php?tid=99314)



Command only when 1 Score? - Deathangel1995 - 26.09.2009

i want to make a Command that only work when the player have 1 Score but here is my Verion but false

Quote:

public OnPlayerPickUpPickup(playerid, pickupid)
{
if(ParkourCP[playerid] == -1)
return 1;

if(ParkourPickups[ParkourCP[playerid]] == pickupid)
{
ParkourCP[playerid]++;
if(ParkourCP[playerid] == sizeof(ParkourCheckpoints))
{
ParkourCP[playerid] = -1;
SetPlayerScore(playerid,GetPlayerScore(playerid) +1); // here you become a scorepoint
SendClientMessage(playerid, 0xFACBADFF, "Youre finished the first parkour.");
SendClientMessage(playerid, 0xFACBADFF, "You get 1 score. (/score)");
SendClientMessage(playerid, 0xFACBADFF, "Use `/parkour2` to start with the next.");
RemovePlayerMapIcon(playerid, MAP_ICON_ID);
}
else
{
new string[12];
format(string, 12, "~b~CP:~w~%i", ParkourCP[playerid]);
GameTextForPlayer(playerid, string, 3000, 5);
SetPlayerMapIcon(playerid, MAP_ICON_ID, ParkourCheckpoints[ParkourCP[playerid]][0], ParkourCheckpoints[ParkourCP[playerid]][1], ParkourCheckpoints[ParkourCP[playerid]][2], 53, 0);
}
}
return 1;
}

Quote:

public OnPlayerCommandText(playerid, cmdtext[])
{
if(GetPlayerScore(playerid) >= 1) // if have a score then make command, when not a score then block the command and send a warning
{
if(strcmp(cmdtext, "/parkour2", true) == 0)
{
ParkourCP[playerid] = 0;
SetPlayerMapIcon(playerid, MAP_ICON_ID, ParkourCheckpoints[0][0], ParkourCheckpoints[0][1], ParkourCheckpoints[0][2], 53, 0);
SetPlayerPos(playerid, 1847.0726,-1593.7416,15.4674);
SetPlayerFacingAngle(playerid, 175.9439);
SetCameraBehindPlayer(playerid);
SetPlayerHealth(playerid, 97.6);
return 1;
}
else
{
SendClientMessage(playerid,rot,"You must complete parkour 1. (/start)"); //message when you not have a scorepoint
}
return 1;
}
return 1;
}

However, there are no errors in the script as a player with one-game score 0 the command nothing happens, even if you have: 1 Score nothing happens.

I want it but have so that if the message is missing: 1 Score.
If a score as the command will simply happen and it will be ported, etc.

Help what is wrong??

Quick help needed!


Re: Command only when 1 Score? - brett7 - 26.09.2009

public OnPlayerCommandText(playerid, cmdtext[])
{
if(GetPlayerScore(playerid) >= 1) // if have a score then make command, when not a score then block the command and send a warning
{
if(strcmp(cmdtext, "/parkour2", true) == 0)
{
ParkourCP[playerid] = 0;
SetPlayerMapIcon(playerid, MAP_ICON_ID, ParkourCheckpoints[0][0], ParkourCheckpoints[0][1], ParkourCheckpoints[0][2], 53, 0);
SetPlayerPos(playerid, 1847.0726,-1593.7416,15.4674);
SetPlayerFacingAngle(playerid, 175.9439);
SetCameraBehindPlayer(playerid);
SetPlayerHealth(playerid, 97.6);
return 1;
}
else
{
SendClientMessage(playerid,rot,"You must complete parkour 1. (/start)"); //message when you not have a scorepoint
}
return SendClientMessage(playerid,rot,"You must have a score of more than 1");
}
return 1;
}


Re: Command only when 1 Score? - Deathangel1995 - 26.09.2009

I type the command but nothing happens...


Re: Command only when 1 Score? - Deathangel1995 - 26.09.2009

help


Re: Command only when 1 Score? - Jay_ - 27.09.2009

Код:
public OnPlayerCommandText(playerid, cmdtext[])
{
  if(!strcmp(cmdtext, "/somecmd"))
  {
    if(GetPlayerScore(playerid) != 1)
      return 0;
   
    // Rest of the cmd 
  
    return 1;
  }

}



Re: Command only when 1 Score? - Deathangel1995 - 27.09.2009

but where is the MSG?


Re: Command only when 1 Score? - Deathangel1995 - 27.09.2009

fuck help..


Re: Command only when 1 Score? - Desert - 27.09.2009

Heres an example

Код:
public OnPlayerCommandText(playerid,cmdtext[])
{
	if(strcmp("/selfheal",cmdtext,true,9) == 0)//The cmd
		if(GetPlayerScore(playerid) != 1)
		{
			SendClientMessage(playerid,0xFFFFFF,"ERROR: Your score is not 1!");//If hes score is not 1
			return 1;
			}
		else
		{
		  SetPlayerHealth(playerid,100);
		  SendClientMessage(playerid,0xFFFFFF,"Your health has been set to 100");//If hes score is 1 he will have hes HP set to 100
		  return 1;
		  }
		return 1;
		}