problem enable / disable goto
#1

this is my script to enable and disable it and goto, only that even though you disabled can the same to goto me, where am I wrong?
Код:
new pstring[500];
new statusgoto[MAX_PLAYERS];
CMD:goto(playerid, params[])
{
		if(isnull(params)) return SendClientMessage(playerid, COLOR_GREEN, "use: {FFFFFF}/goto [playerid/nick]");
		new name[24], name2[24], temp_id = -1;
		if(IsNumeric(params))
			temp_id = strval(params);
		else
		    {
			foreach(Player, i)
			{
				GetPlayerName(i, name, 24);
				if(strfind(name, params, true)!=-1)
			            {
			            temp_id=i;
			            break;
			            }
			}
			}
        if(statusgoto[strval(tmp)] == 1) return SendClientMessage(playerid, COLOR_RED, "this player goto Off!");
		if(!IsPlayerConnected(temp_id) || temp_id == -1) return SendClientMessage(playerid, COLOR_GREEN, "player not in game.");
		if(playerid == temp_id) return SendClientMessage(playerid, COLOR_RED, "[ERROR:] {C1C1C1}no goto you.");
		GetPlayerName(temp_id, name, 24);
		GetPlayerName(playerid, name2, 24);
		format(pstring, 500, "%s{A1A1E4}[%s] {C1C1C1}goto you.", name2);
		SendClientMessage(temp_id, -1, pstring);
		format(pstring, 500, "{C1C1C1}you goto %s.", name);
		SendClientMessage(playerid, -1, pstring);
		new Float: xpos, Float:ypos, Float:zpos;
		GetPlayerPos(temp_id, xpos, ypos, zpos);
		if(GetPlayerState(playerid) != PLAYER_STATE_DRIVER)
		    {
			SetPlayerPos(playerid, xpos, ypos, zpos+2.0);
			}
		else
		    {
		    SetVehiclePos(GetPlayerVehicleID(playerid), xpos, ypos + 2.0, zpos + 2.0);
		    }
		return 1;
}
CMD:gotooff(playerid, params[])
{
statusgoto[playerid] = 1;
SendClientMessage(playerid, COLOR_RED -1, "{ff0000}imposted goto OFF");
return 1;
}
CMD:gotoon(playerid, params[])
{
statusgoto[playerid] = 0;
SendClientMessage(playerid, COLOR_RED -1, "{ff0000}imposted goto ON");
return 1;
}
Reply
#2

try change

PHP код:
statusgoto[strval(tmp)] 
to

PHP код:
statusgoto[temp_id
Reply
#3

it works perfectly! thank you very much
+ rep
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)