[HELP PLEASE]Multiple commands. -
[A51]Play3r1337 - 19.07.2009
Hello , im beginner in scripting but i tried make multiple commands but then i get like 26 errors.
Can anyone tell me how to create Multiple commands?Thanks.
Re: [HELP PLEASE]Multiple commands. -
kc - 19.07.2009
Now think...
How are we supposed to help you without you posting any code or errors?
Re: [HELP PLEASE]Multiple commands. -
sggassasin - 19.07.2009
here ill give you some common commands
Код:
if (strcmp("/kill", cmdtext, true, 10) == 0)
{
SetPlayerHealth(playerid,0);
return 1;
}
if (strcmp("/help", cmdtext, true, 10) == 0)
{
SendClientMessage(playerid,0x33AA33AA,"Please Choose A Sub Category");
SendClientMessage(playerid,0xAA3333AA,"-----------------------------------");
SendClientMessage(playerid,0x33AA33AA,"/rules");
SendClientMessage(playerid,0xAA3333AA,"-----------------------------------");
SendClientMessage(playerid,0x33AA33AA,"/cmd");
return 1;
}
if (strcmp("/cmd", cmdtext, true, 10) == 0)
{
SendClientMessage(playerid,0xAFAFAFAA,"/flip /para /Fix (buy) /kill(not work due to briefcase fix soon) /weaponlist1 /weaponpack /countdown /(un)lock");
return 1;
}
if (strcmp("/rules", cmdtext, true, 10) == 0)
{
SendClientMessage(playerid,0xFFFF00AA,"1.Do not abuse other players. Respect everyone on this server");
SendClientMessage(playerid,0xFFFF00AA,"2.If you fail to follow the rules you will get a warning. 3 warnings = BAN");
SendClientMessage(playerid,0xFFFF00AA,"3.Do not hack! Hackers will only be given one warning before they are banned");
SendClientMessage(playerid,0xFFFF00AA,"4.Don't ask for Admin rights");
SendClientMessage(playerid,0xFFFF00AA,"5.Have Fun! :)");
return 1;
}
need any more help pm or my xfire is terry12345678
Re: [HELP PLEASE]Multiple commands. -
kc - 19.07.2009
..?
Without posting the code that is giving you the errors, and the errors themselves I can't help.
Re: [HELP PLEASE]Multiple commands. -
Anarkien - 19.07.2009
Well, at least you'll have to indent your code - that can solve a lot of your problems I guess.
Re: [HELP PLEASE]Multiple commands. -
Finn - 19.07.2009
You need to learn to use
strcmp.
This is wrong:
if(strcmp("/rules", cmdtext, true, 10) == 0)
The number 10 you have in the function has to be the amount of characters the string (in this case "/rules") has. So, as you can see the number is wrong, because "/rules" has 6 characters.
You need to use:
if(strcmp("/rules", cmdtext, true, 6) == 0)
or:
if(strcmp("/rules", cmdtext, true) == 0)
strcmp in SA-MP wiki
Re: [HELP PLEASE]Multiple commands. -
sggassasin - 19.07.2009
ya i know it just was a coppy and past from a tutroial i was makeing
Re: [HELP PLEASE]Multiple commands. -
[A51]Play3r1337 - 19.07.2009
sgassasin got my problem solved..
i meant how can i make many commands in like same place or however you call it
All i needed to know was this
Код:
return 1;
}
if (strcmp("/cmd", cmdtext, true, 10) == 0)
{
How to start the new command after the old one. Thats all. Thank you sgassasin
Re: [HELP PLEASE]Multiple commands. -
sggassasin - 19.07.2009
np m8 any time