Script Problem, i need help
#1

FINDING(giveplayerid, playerid)
{
new Float:X, Float:Y, Float:Z;
GetPlayerPos(giveplayerid, X,Y,Z);
SetPlayerCheckpoint(playerid, X,Y,Z, 6);
return 1;
}

I put this on TOP, before some "new xyz;"

At onplayercommandtext, is FINDING(giveplayerid, playerid);

All is fine... But, when i try to do it on timer, dosen't works.
I put public&forward.

SetTimerEx("FINDING", 1000, true "i", playerid);

What i need to put in "i" place?
When i do it working it show checkpoint to giveplayerid, not to playerid.
Help me. Sorry for my bad english.

PS: giveplayerid is defined at onplayercommandtext...
Reply
#2

You need to pass the function two integers, so use "ii" and pass id of the second player
PHP код:
SetTimerEx("FINDING"1000true "ii"giveplayeridplayerid); 
you need to get value of giveplayerid ofc...
Reply
#3

Thanks!
+rep.
Reply
#4

If i want to do it on ID?
Number, "dd"?
Reply
#5

"d" and "i" are both integers, therefore it does not matter which one you use.
Reply
#6

It works but when is used by 2+ all is down.
It set checkpoints wrong.
I do it with timer, dosen't work.
Another idea?
forward FINDING(giveplayerid, playerid)
public FINDING(giveplayerid, playerid)
{
new Float:X, Float:Y, Float:Z;
GetPlayerPos(giveplayerid, X,Y,Z);
SetPlayerCheckpoint(playerid, X,Y,Z, 6);
return 1;
}
I want do, when player command text, to setcheckpoint following target.
onplayercommandtext

Код:
    if(strcmp(cmd, "/find", true) == 0)
	{
	    if(IsPlayerConnected(playerid))
	    {
		    if(PlayerInfo[playerid][pJob] != 1)
		    {
				SendClientMessage(playerid, COLOR_GREY, "   You are not a Detective !");
				return 1;
		    }
		    if(PlayerOnMission[playerid] > 0)
			{
				SendClientMessage(playerid, COLOR_GREY, "   On a mission right now, can't use this command !");
			    return 1;
			}
			if(UsedFind[playerid] != 0 && PlayerInfo[playerid][pDetSkill] < 401)
			{
			    SendClientMessage(playerid, COLOR_GREY, "   You've already searched for someone, wait 2 minutes !");
			    return 1;
			}
			if(IsAtStuntEvent[playerid] == 1)
			{
			    SendClientMessage(playerid, COLOR_GREY, "Nu poti folosi /find atata timp cat esti la stunt event.{FFFFFF} /leavestuntevent");
			    return 1;
			}
			if(CashboxOwner == playerid)
				{
					SendClientMessage(playerid, COLOR_GREY, "    Nu poti folosi /find cand ai servieta !");
					return 1;
				}   	
		    tmp = strtok(cmdtext, idx);
			if(!strlen(tmp))
			{
				SendClientMessage(playerid, COLOR_GRAD2, "{D580FE}Foloseste:{FFFFFF} /find [playerid/PartOfName]");
				return 1;
			}
			giveplayerid = ReturnUser(tmp);
			if(IsPlayerConnected(giveplayerid))
			{
			    if(giveplayerid != INVALID_PLAYER_ID)
			    {
			        if(giveplayerid == playerid) { SendClientMessage(playerid, COLOR_GREY, "You cannot Find yourself!"); return 1; }
			        new points;
			        new level = PlayerInfo[playerid][pDetSkill];
					if(level >= 0 && level <= 50)
					{ points = 4; }
					else if(level >= 51 && level <= 100)
					{ points = 6; }
					else if(level >= 101 && level <= 200)
					{ points = 8; }
					else if(level >= 201 && level <= 400)
					{ points = 10; }
					else if(level >= 401)
					{ points = 12; }
				    GetPlayerName(giveplayerid, giveplayer, sizeof(giveplayer));
                                      FINDING(giveplayerid, playerid);
					FindTime[playerid] = 1;
					FindTimePoints[playerid] = points;
					PlayerInfo[playerid][pDetSkill] ++;
					UsedFind[playerid] = 1;
					if(PlayerInfo[playerid][pDetSkill] == 50)
					{ SendClientMessage(playerid, COLOR_YELLOW, "* Your Detective Skill is now Level 2, soon you are able to find Faction Members."); }
					else if(PlayerInfo[playerid][pDetSkill] == 100)
					{ SendClientMessage(playerid, COLOR_YELLOW, "* Your Detective Skill is now Level 3, soon you are able to find Faction Members."); }
					else if(PlayerInfo[playerid][pDetSkill] == 200)
					{ SendClientMessage(playerid, COLOR_YELLOW, "* Your Detective Skill is now Level 4, you are now able to find Faction Members."); }
					else if(PlayerInfo[playerid][pDetSkill] == 400)
					{ SendClientMessage(playerid, COLOR_YELLOW, "* Your Detective Skill is now Level 5, you are now able to find Faction Members."); }
				}
			}
			else
			{
			    SendClientMessage(playerid, COLOR_GREY, "   Invalid Name/ID !");
			}
		}
	    return 1;
	}
Some ideas for repeating that FINDING?
With timer is doing bugs when it used by 2+
Sorry for my bad English!

Simple command
Код:
    if(strcmp(cmd, "/find", true) == 0)
	{
	    if(IsPlayerConnected(playerid))
	    {
		    tmp = strtok(cmdtext, idx);
			if(!strlen(tmp))
			{
				SendClientMessage(playerid, COLOR_GRAD2, "{D580FE}Foloseste:{FFFFFF} /find [playerid/PartOfName]");
				return 1;
			}
			giveplayerid = ReturnUser(tmp);
			if(IsPlayerConnected(giveplayerid))
			{
			    if(giveplayerid != INVALID_PLAYER_ID)
			    {
				    new Float:X, Float:Y, Float:Z;
                    GetPlayerPos(giveplayerid, X,Y,Z);
	                SetPlayerCheckpoint(playerid, X,Y,Z, 6);
                }
			}
		}
	    return 1;
	}
Command with FINDING
Код:
    if(strcmp(cmd, "/find", true) == 0)
	{
	    if(IsPlayerConnected(playerid))
	    {
		    tmp = strtok(cmdtext, idx);
			if(!strlen(tmp))
			{
				SendClientMessage(playerid, COLOR_GRAD2, "{D580FE}Foloseste:{FFFFFF} /find [playerid/PartOfName]");
				return 1;
			}
			giveplayerid = ReturnUser(tmp);
			if(IsPlayerConnected(giveplayerid))
			{
			    if(giveplayerid != INVALID_PLAYER_ID)
			    {
FINDING(giveplayerid, playerid);
                }
			}
		}
	    return 1;
	}
All is working but i can't do it repeat. Please help me!
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)