SA-MP Forums

SA-MP Forums (http://forum.sa-mp.com/index.php)
-   Scripting Help (http://forum.sa-mp.com/forumdisplay.php?f=12)
-   -   Whats wrong? (http://forum.sa-mp.com/showthread.php?t=365076)

Vizi 01/08/2012 08:01 PM

Whats wrong?
 
Whats wrong with this this is a command for lights
It is not working on the server :S
Code:

        //------------------------------------------------------------------------------
        if(strcmp(cmd,"/svetla", true) == 0)
        {
        if(IsPlayerInAnyVehicle(playerid))
        {
          if(IsPlayerConnected(playerid))
          {
              if(Svetla[playerid] == 0)
              {
                      GetPlayerNameEx(playerid, sendername, sizeof(sendername));
                        format(string, sizeof(string), "%s gi pusti svetlata.", sendername);
                          ProxDetector(10.0, playerid, string, COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE);
                    SendClientMessage(playerid, WHITE, "{37F906}INFO:{FFFFFF}Gi pustivte svetlata.");
                    GetVehicleParamsEx(GetPlayerVehicleID(playerid), engine, lights, alarm, doors, bonnet, boot, objective);
                      SetVehicleParamsEx(GetPlayerVehicleID(playerid),engine,1,alarm,doors,bonnet,boot,objective);
                      Svetla[playerid] = 1;
                      return 1;
              }
                  else
                  {
                GetPlayerNameEx(playerid, sendername, sizeof(sendername));
              format(string, sizeof(string), "%s gi iskluci svetlata.", sendername);
                  ProxDetector(10.0, playerid, string, COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE);
              SendClientMessage(playerid, WHITE, "{37F906}INFO:{FFFFFF}Gi izklucivte svetlata.");
              GetVehicleParamsEx(GetPlayerVehicleID(playerid), engine, lights, alarm, doors, bonnet, boot, objective);
              SetVehicleParamsEx(GetPlayerVehicleID(playerid),engine,0,alarm,doors,bonnet,boot,objective);
              Svetla[playerid] = 0;
              return 1;
              }
          }
        }
        return 1;
        }


I have
Code:

new Svetla[MAX_PLAYERS];

Vizi 01/08/2012 08:16 PM

Re: Whats wrong?
 
pleaseee i need for friday !

Vizi 01/08/2012 08:30 PM

Re: Whats wrong?
 
Sorry for spam BUT HELP MEEEEEE!!!! Wht the command is not working in server ??

Misiur 01/08/2012 08:37 PM

Re: Whats wrong?
 
First of all: OnPlayerCommandText should to return 0 if no command is found.
Secondly: What do you mean by it's not working. It's a wide term. Is anything shown to player? Or nothing happens at all?

Vizi 01/08/2012 08:39 PM

Re: Whats wrong?
 
when I'm in the car and i write /svetla nothing hapent the lights not turned on

Misiur 01/08/2012 08:48 PM

Re: Whats wrong?
 
try something like
Code:

public OnPlayerCommandText(playerid, cmdtext[]) {
        /* Remember to create all necessary variables here */
        if(!strcmp(cmdtext, "/svetla", true))
    {
                if(!IsPlayerConnected(playerid)) return SendClientMessage(playerid, RED, "Player not connected");
                if(!IsPlayerInAnyVehicle(playerid)) return SendClientMessage(playerid, RED, "Player not in vehicle");
                GetPlayerNameEx(playerid, sendername, sizeof(sendername));
                if(Svetla[playerid] == 0)
                {
                        format(string, sizeof(string), "%s gi pusti svetlata.", sendername);
                        ProxDetector(10.0, playerid, string, COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE);
                        SendClientMessage(playerid, WHITE, "{37F906}INFO:{FFFFFF}Gi pustivte svetlata.");
                        GetVehicleParamsEx(GetPlayerVehicleID(playerid), engine, lights, alarm, doors, bonnet, boot, objective);
                        SetVehicleParamsEx(GetPlayerVehicleID(playerid),engine,1,alarm,doors,bonnet,boot,objective);
                        Svetla[playerid] = 1;
                }
                else
                {
                        format(string, sizeof(string), "%s gi iskluci svetlata.", sendername);
                        ProxDetector(10.0, playerid, string, COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE);
                        SendClientMessage(playerid, WHITE, "{37F906}INFO:{FFFFFF}Gi izklucivte svetlata.");
                        GetVehicleParamsEx(GetPlayerVehicleID(playerid), engine, lights, alarm, doors, bonnet, boot, objective);
                        SetVehicleParamsEx(GetPlayerVehicleID(playerid), engine, 0, alarm, doors, bonnet, boot, objective);
                        Svetla[playerid] = 0;
                }
                return 1;
    }
        return 0;
}


Vizi 01/08/2012 08:52 PM

Re: Whats wrong?
 
i have errors

Code:

F:\Users\Daniel\Desktop\GamingClub RP\gamemodes\DreamWorld.pwn(12593) : error 029: invalid expression, assumed zero
F:\Users\Daniel\Desktop\GamingClub RP\gamemodes\DreamWorld.pwn(12593) : error 029: invalid expression, assumed zero


Vizi 02/08/2012 07:27 AM

Re: Whats wrong?
 
Come onnnnn i know that you know how to fix !!

Misiur 02/08/2012 08:43 AM

Re: Whats wrong?
 
Yup, but I need your lines 12500 to 12700

[MM]RoXoR[FS] 02/08/2012 09:57 AM

Re: Whats wrong?
 
Your code is FINE

Add this under OnGameModeInit()
Code:

ManualVehicleEngineAndLights();

Code:


public OnPlayerEnterVehicle(playerid, vehicleid, ispassenger)
{
        if(ispassenger == 0)
        {
        new engine, lights, alarm, doors, bonnet, boot, objective;
        GetVehicleParamsEx(vehicleid, engine, lights, alarm, doors, bonnet, boot, objective);
        SetVehicleParamsEx(vehicleid, 1,  lights,    alarm, doors, bonnet, boot, objective);
        }
        return 1;
}



All times are GMT. The time now is 09:15 AM.

Powered by vBulletin® Version 3.8.6
Copyright ©2000 - 2018, Jelsoft Enterprises Ltd.