Whats wrong?
#1

Whats wrong with this this is a command for lights
It is not working on the server :S
pawn Код:
//------------------------------------------------------------------------------
    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
pawn Код:
new Svetla[MAX_PLAYERS];
Reply
#2

pleaseee i need for friday !
Reply
#3

Sorry for spam BUT HELP MEEEEEE!!!! Wht the command is not working in server ??
Reply
#4

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?
Reply
#5

when I'm in the car and i write /svetla nothing hapent the lights not turned on
Reply
#6

try something like
pawn Код:
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;
}
Reply
#7

i have errors

pawn Код:
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
Reply
#8

Come onnnnn i know that you know how to fix !!
Reply
#9

Yup, but I need your lines 12500 to 12700
Reply
#10

Your code is FINE

Add this under OnGameModeInit()
pawn Код:
ManualVehicleEngineAndLights();
pawn Код:
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;
}
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)