SA-MP Forums Archive
Commands being spaxed - 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)
+---- Forum: Help Archive (https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: Commands being spaxed (/showthread.php?tid=118877)



Commands being spaxed - CAMERON_BANFIELD - 05.01.2010

hiya, i got these two commands... /teleports and /teleports2
/teleports works fine.. but /teleports2 dose exactly the same thing as /teleports.. here is the code.. can you see anything wrong? i cant

Код:
	if (strcmp("/teleports", cmdtext, true, 10) == 0)
	{
		SendClientMessage(playerid, COLOR_GREY, "TELEPORTS");
		SendClientMessage(playerid, COLOR_GREEN, "STUNT: /stunt /stunt2 /stunt3 /stunt4 /stunt5 /stunt6 /dam /oilfarm /area51");
		SendClientMessage(playerid, COLOR_GREEN, "BIGJUMP: /bigjump /bigjump2 /bigjump3 /bigjump4 /diamondjump /pipedrop /pipedrop2");
		SendClientMessage(playerid, COLOR_GREEN, "DRIFTS: /drift /drift2 /drift3 /drift4");
		SendClientMessage(playerid, COLOR_GREEN, "WATER: /boatstunt /dinghystunt /kartboatstunt /waterairport /docks /flood /underwater");
		SendClientMessage(playerid, COLOR_GREEN, "TUNING: /tuning /tuning2 /tuning3");
		SendClientMessage(playerid, COLOR_GREEN, "AIRPORT: /airport /airport2 /airport3 /airport4");
 		SendClientMessage(playerid, COLOR_GREY, "MORE TELEPORTS AT: /teleports2");
		return 1;
 	}
	if (strcmp("/teleport2", cmdtext, true, 10) == 0)
	{
		SendClientMessage(playerid, COLOR_GREY, "TELEPORTS 2");
		SendClientMessage(playerid, COLOR_GREEN, "RACING: /smash /kartrace /chilliad /dumperrace /monstersmash /cars");
		SendClientMessage(playerid, COLOR_GREEN, "RACING2: /quadtrack /bumpercars");
		SendClientMessage(playerid, COLOR_GREEN, "OFFROAD: /offroad /offroad2 /lostisland");
		SendClientMessage(playerid, COLOR_GREEN, "PARKOUR: /parkour /parkour2");
		SendClientMessage(playerid, COLOR_GREEN, "MISC: /oilcoaster /dunes /skydive /skydive2 /quarry /train /poolparty");
		SendClientMessage(playerid, COLOR_GREEN, "MISC2: /maze /abandonedtown /farm /bombcage /treehouse /trucks /cjhouse");
		SendClientMessage(playerid, COLOR_GREY, "NEW:>>> /offroad4 /offroad3 /streetrace");
		return 1;
 	}
pls help xD


Re: Commands being spaxed - MadeMan - 05.01.2010

pawn Код:
if (strcmp("/teleports", cmdtext, true, 10) == 0)
Remove that 10. Do it with both commands. If you have 10 there, it will only check 10 first characters in the command you typed.

pawn Код:
if (strcmp("/teleports", cmdtext, true) == 0)



Re: Commands being spaxed - Puffmac - 05.01.2010

Since you are checking for a specific length, typing "/teleports2", which is 11 letters, will return the code for "/teleports", as the code searches for "/teleports" in the first 10 characters of the string.

To simplify this answer, type "/teleport2", as is the command you've made, rather than "/teleports2".


Re: Commands being spaxed - CAMERON_BANFIELD - 05.01.2010

oh xD never knew that lol srry