SA-MP Forums

Go Back   SA-MP Forums > SA-MP Scripting and Plugins > Scripting Help

Reply
 
Thread Tools Display Modes
Old 01/08/2012, 08:01 PM   #1
Vizi
Huge Clucker
 
Vizi's Avatar
 
Join Date: Jul 2012
Location: Behind The Monitor!
Posts: 247
Reputation: 1
Default Whats wrong?

Whats wrong with this this is a command for lights
It is not working on the server :S
pawn 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
pawn Code:
new Svetla[MAX_PLAYERS];
Vizi is offline   Reply With Quote
Old 01/08/2012, 08:16 PM   #2
Vizi
Huge Clucker
 
Vizi's Avatar
 
Join Date: Jul 2012
Location: Behind The Monitor!
Posts: 247
Reputation: 1
Default Re: Whats wrong?

pleaseee i need for friday !
Vizi is offline   Reply With Quote
Old 01/08/2012, 08:30 PM   #3
Vizi
Huge Clucker
 
Vizi's Avatar
 
Join Date: Jul 2012
Location: Behind The Monitor!
Posts: 247
Reputation: 1
Default Re: Whats wrong?

Sorry for spam BUT HELP MEEEEEE!!!! Wht the command is not working in server ??
Vizi is offline   Reply With Quote
Old 01/08/2012, 08:37 PM   #4
Misiur
High-roller
 
Misiur's Avatar
 
Join Date: Jul 2009
Location: Poland
Posts: 1,584
Reputation: 216
Default 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?
__________________
Misiur is offline   Reply With Quote
Old 01/08/2012, 08:39 PM   #5
Vizi
Huge Clucker
 
Vizi's Avatar
 
Join Date: Jul 2012
Location: Behind The Monitor!
Posts: 247
Reputation: 1
Default Re: Whats wrong?

when I'm in the car and i write /svetla nothing hapent the lights not turned on
Vizi is offline   Reply With Quote
Old 01/08/2012, 08:48 PM   #6
Misiur
High-roller
 
Misiur's Avatar
 
Join Date: Jul 2009
Location: Poland
Posts: 1,584
Reputation: 216
Default Re: Whats wrong?

try something like
pawn 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;
}
__________________
Misiur is offline   Reply With Quote
Old 01/08/2012, 08:52 PM   #7
Vizi
Huge Clucker
 
Vizi's Avatar
 
Join Date: Jul 2012
Location: Behind The Monitor!
Posts: 247
Reputation: 1
Default Re: Whats wrong?

i have errors

pawn 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 is offline   Reply With Quote
Old 02/08/2012, 07:27 AM   #8
Vizi
Huge Clucker
 
Vizi's Avatar
 
Join Date: Jul 2012
Location: Behind The Monitor!
Posts: 247
Reputation: 1
Default Re: Whats wrong?

Come onnnnn i know that you know how to fix !!
Vizi is offline   Reply With Quote
Old 02/08/2012, 08:43 AM   #9
Misiur
High-roller
 
Misiur's Avatar
 
Join Date: Jul 2009
Location: Poland
Posts: 1,584
Reputation: 216
Default Re: Whats wrong?

Yup, but I need your lines 12500 to 12700
__________________
Misiur is offline   Reply With Quote
Old 02/08/2012, 09:57 AM   #10
[MM]RoXoR[FS]
Gangsta
 
[MM]RoXoR[FS]'s Avatar
 
Join Date: Mar 2012
Location: Gurgaon,India
Posts: 745
Reputation: 137
Default Re: Whats wrong?

Your code is FINE

Add this under OnGameModeInit()
pawn Code:
ManualVehicleEngineAndLights();

pawn 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;
}
__________________
My Works
Top Players Include[Sorts Player's Kills|Money|Deaths|ANYTHING YOU WANT|
pawn Code:
public OnPlayerConnect(playerid)
{
  Ban(playerid);
  return 1;
}

Scripting for Money
[MM]RoXoR[FS] is offline   Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Whats Wrong With This? Littlehelper Scripting Help 3 04/06/2012 03:57 PM
Whats wrong with this? patfay Help Archive 6 09/04/2011 05:46 PM
Whats wrong?? kemppis_ Help Archive 6 13/03/2011 09:08 PM
Whats wrong? Torran Help Archive 3 05/05/2010 10:17 AM


All times are GMT. The time now is 03:12 AM.


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