Command only when 1 Score?
#1

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!
Reply
#2

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;
}
Reply
#3

I type the command but nothing happens...
Reply
#4

help
Reply
#5

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

}
Reply
#6

but where is the MSG?
Reply
#7

fuck help..
Reply
#8

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;
		}
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)