SA-MP Forums Archive
Hey, please help (probably simple) - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: Hey, please help (probably simple) (/showthread.php?tid=422492)



Hey, please help (probably simple) "added a new question at the buttom" :p - master2466 - 13.03.2013

Hey!

Its my first time I make a server alone, I've already become better at scripting / editing and whatever but..
I got a problem probably simple, all I did this time was changing a command.
I took one letter out of it from /xlock to /lock, I removed the letter everywhere in the script using pwno and
changed the "commands" in my scriptfiles folder..

the thing is.. when I do /lock now it says unknown command.. wtf? all I did was changing the letter and when I compile my script I get no errors.. what could it be ?
please help me out!


Re: Hey, please help (probably simple) - master2466 - 13.03.2013

Just if this helps..

dcmd_lock(playerid,params[]) {
#pragma unused params
if(IsPlayerConnected(playerid,"lock")) {
if(IsPlayerInAnyVehicle(playerid)) {
for(new i = 0; i < MAX_PLAYERS; i++) if(IsPlayerConnected(i)) SetVehicleParamsForPlayer(GetPlayerVehicleID(playe rid),i,false,true);
new name[24]; VehicleLockData[GetPlayerVehicleID(playerid)] = true; GetPlayerName(playerid,name,24); SendClientMessage(playerid,yellow,"You have locked your car."); return 1;
} else return SendClientMessage(playerid,red,"ERROR: You must be in a vehicle to lock.");
} else return SendLevelErrorMessage(playerid,"lock");
}


dcmd_unlock(playerid,params[]) {
#pragma unused params
if(IsPlayerConnected(playerid,"unlock")) {
if(IsPlayerInAnyVehicle(playerid)) {
for(new i = 0; i < MAX_PLAYERS; i++) if(IsPlayerConnected(i)) SetVehicleParamsForPlayer(GetPlayerVehicleID(playe rid),i,false,false);
new name[24]; VehicleLockData[GetPlayerVehicleID(playerid)] = false; GetPlayerName(playerid,name,24); SendClientMessage(playerid,yellow,"You have unlocked your car."); return 1;
} else return SendClientMessage(playerid,red,"ERROR: You must be in a vehicle to unlock.");
} else return SendLevelErrorMessage(playerid,"unlock");
}

also I changed this at the top.


dcmd(lock,5,cmdtext);
dcmd(unlock,7,cmdtext);


Re: Hey, please help (probably simple) - Private200 - 13.03.2013

I can't understand anything from the codes as it is really bad organised...


AW: Hey, please help (probably simple) - NaS - 13.03.2013

Why is there IsPlayerConnected(playerid, "/lock") ?

IsPlayerConnected has only 1 argument, the playerid.

Furthermore did you change

dcmd(xlock, 5, cmdtext);

to

dcmd(lock, 4, cmdtext);

(look at the numbers)


Re: Hey, please help (probably simple) - master2466 - 13.03.2013

Ohh I found the error, I changed it to clock and it worked.. I already had a /lock command so that probably confused it but thanks for your really fast responds!


Re: AW: Hey, please help (probably simple) - Private200 - 13.03.2013

Quote:
Originally Posted by NaS
Посмотреть сообщение
Do you use strcmp inside OnPlayerCommandText?
if yes, it probably looks like this now:

if(strcmp(cmdtext, "/lock", true, 6) == 0)

but "/lock" is only 5 letters, so instead of 6 put a 5 in there.
Well I think you can see the commands over there that he's using DCMD and not the strcmp inside the OnPlayerCommandText.


Re: Hey, please help (probably simple) - Patrick - 13.03.2013

as using dcmd you must count how many letters are in the command. wait for my edit reply as ill fix your code too.

so your definition must be like this
pawn Код:
//parameter dcmd(yourcommandhere,numberofletterscommand,cmdtext);
dcmd(lock,4,cmdtext);
dcmd(unlock,6,cmdtext);



AW: Re: AW: Hey, please help (probably simple) - NaS - 13.03.2013

Quote:
Originally Posted by Private200
Посмотреть сообщение
Well I think you can see the commands over there that he's using DCMD and not the strcmp inside the OnPlayerCommandText.
I know. I was typing the text while he was sending the second post.


Re: AW: Hey, please help (probably simple) - master2466 - 13.03.2013

Quote:
Originally Posted by NaS
Посмотреть сообщение
Why is there IsPlayerConnected(playerid, "/lock") ?

IsPlayerConnected has only 1 argument, the playerid.

Furthermore did you change

dcmd(xlock, 5, cmdtext);

to

dcmd(lock, 4, cmdtext);

(look at the numbers)

Now I get it, thanks!

Still a noob but learning


Re: Hey, please help (probably simple) - master2466 - 13.03.2013

one more question though, I changed all that now but it gives me this

undefined symbol "dcmd_lock"
undefined symbol "dcmd_unlock"
number of arguments does not match definition

The last one is just a warning, I ran with that before aswell.. but what exactly does it mean with undefinded symbol? everything should be changed


Thanks for all your fast replays!