Textdraws Problem
#1

I got problem with my 2 textdraws : engine and stats here's the code :

Код:
public OnPlayerClickTextDraw(playerid, Text:clickedid)
{
    if(_:clickedid != INVALID_TEXT_DRAW)
    {
	    if(clickedid == TDMenu2) // Show Stats
	    {
   	    	return cmd_stats(playerid, params[]);
	    }
	    else if(clickedid == TDMenu4) // Turn On Car Engine
	    {
	     	return cmd_cengine(playerid, params[]);
	    }
	    else if(clickedid == TDMenu5) // Turn On Car Lights
	    {
			new vehicleid = GetPlayerVehicleID(playerid);
	        if(GetVehicleModel(vehicleid) == 481 || GetVehicleModel(vehicleid) == 509 || GetVehicleModel(vehicleid) == 510) return SendClientMessageEx(playerid,COLOR_WHITE,"This command can't be used in this vehicle.");
	        SetVehicleLights(vehicleid, playerid);
			//return cmd_clights;
	    }

                     // Hide the game menu after he clicked what he needed.
	    TextDrawHideForPlayer(playerid, TDMenu2);
	    TextDrawHideForPlayer(playerid, TDMenu4);
	    TextDrawHideForPlayer(playerid, TDMenu5);
	    CancelSelectTextDraw(playerid);
	}
 	return 1;
}
Код:
CMD:gamemenu(playerid,params[])
{
    TextDrawShowForPlayer(playerid, TDMenu2);//STATS
    TextDrawShowForPlayer(playerid, TDMenu5);//ENGINE
    TextDrawShowForPlayer(playerid, TDMenu4);//LIGHTS
	SelectTextDraw(playerid, 0xAFAFAFAA);
    return 1;
}
Commands : cengine, stats

Код:
CMD:cengine(playerid, params[])
{
new engine,lights,alarm,doors,bonnet,boot,objective,vehicleid;
        new string[128];
        vehicleid = GetPlayerVehicleID(playerid);
        if(GetVehicleModel(vehicleid) == 481 || GetVehicleModel(vehicleid) == 509 || GetVehicleModel(vehicleid) == 510) return SendClientMessageEx(playerid,COLOR_WHITE,"This command can't be used in this vehicle.");
        GetVehicleParamsEx(vehicleid,engine,lights,alarm,doors,bonnet,boot,objective);
        if(engine == VEHICLE_PARAMS_ON)
        {
            SetVehicleEngine(vehicleid, playerid);
        }
        else if((engine == VEHICLE_PARAMS_OFF || engine == VEHICLE_PARAMS_UNSET))
        {
               SendClientMessageEx(playerid, COLOR_WHITE, "Vehicle engine starting, please wait...");
               new rand = random(4);
               if(rand == 0)
               {
                   SetTimerEx("SetVehicleEngine", 1000, 0, "dd",  vehicleid, playerid);
                   SendClientMessage(playerid, COLOR_TWYELLOW, "Vehicle engine started");
                   format(string, sizeof(string), "* %s has started his vehicle's engine",  GetPlayerNameEx(playerid));
                   ProxDetector(30.0, playerid, string, COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE);
               }
               if(rand == 1)
               {
                   SendClientMessage(playerid, COLOR_TWYELLOW, "Vehicle engine failed to start");
                   format(string, sizeof(string), "* %s struggles to start the engine but fails",  GetPlayerNameEx(playerid));
                   ProxDetector(30.0, playerid, string, COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE);
               }
               if(rand == 2)
               {
                   SetTimerEx("SetVehicleEngine", 1000, 0, "dd",  vehicleid, playerid);
                   SendClientMessage(playerid, COLOR_TWYELLOW, "Vehicle engine started");
                   format(string, sizeof(string), "* %s has started his vehicle's engine",  GetPlayerNameEx(playerid));
                   ProxDetector(30.0, playerid, string, COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE);
               }
               if(rand == 3)
               {
                   SetTimerEx("SetVehicleEngine", 1000, 0, "dd",  vehicleid, playerid);
                   SendClientMessage(playerid, COLOR_TWYELLOW, "Vehicle engine started");
                   format(string, sizeof(string), "* %s has started his vehicle's engine",  GetPlayerNameEx(playerid));
                   ProxDetector(30.0, playerid, string, COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE);
               }
        }
return 1;
} 

-- Stats --

CMD:stats(playerid, params[]) {
	if (gPlayerLogged{playerid} != 0) {
		ShowStats(playerid,playerid);
	}
	return 1;
}
Errors :
Код:
F:\Servers\Samp\Razer Gaming Roleplay\gamemodes\RZRP.pwn(32023) : error 017: undefined symbol "params"
F:\Servers\Samp\Razer Gaming Roleplay\gamemodes\RZRP.pwn(32027) : error 017: undefined symbol "params"
Pawn compiler 3.2.3664	 	 	Copyright © 1997-2006, ITB CompuPhase


2 Errors.
PS : The Lights work perfect and the rest ... total shit
Reply
#2

you can't use params in OnPlayerClickTextDraw because it doesn't defined in this callback

PHP код:
if(clickedid == TDMenu2// Show Stats
        
{
               return 
cmd_stats(playerid"");
        }
        else if(
clickedid == TDMenu4// Turn On Car Engine
        
{
             return 
cmd_cengine(playerid,"");
        } 
use this
Reply
#3

Thanks for the feedback but when I click on Stats / Engine / Lights it turns lights on any ideas?
Reply
#4

Someone?
Reply
#5

you mean any textdraw that you click on it your lights of car will turn on?!
Reply
#6

Yes..
Reply
#7

what's this?!

SetVehicleEngine

can you show me what's in SetVehicleEngine?!
Reply
#8

Actually when I click on Engine it turns engine on as well but it turns lights on too
Reply
#9

Anyone??
Reply
#10

change this
PHP код:
SetVehicleEngine 
to this one

PHP код:
     new engine,lights,alarm,doors,bonnet,boot,objective;
     
GetVehicleParamsEx(vid,engine,lights,alarm,doors,bonnet,boot,objective);
     
SetVehicleParamsEx(vid,VEHICLE_PARAMS_ON,lights,alarm,doors,bonnet,boot,objective); 
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)