07.03.2017, 20:05
Some Suggestions:
1- Not needed variables
using those variables make no sense(it's took memory) so better use native directly
like this:
2- no sense
this one will return some debug informations in console so better
3- Expressions
this is a old way to make a switch for ids and it's make complie time too long than normall (most unoticed)
so better use this
and for checking use case 0: or case 1:
and if you don't know id 1 or 0 in most gm's are already used, so that will make your dialogs unable to give back the informations and can make a crash in some cases
what to do ? use some ids +10k for make the ids confils impossible.
4 - The wrost idea ever
making it on OnPlayerSpawn will create a CP and Text and a Actor every time a player spawn and that will make a BAD HOT Lag around the ammu can crash players and make them unable to access to it
so better change it to
5-about FSExit
as i see in your script you didn't touch OnFilterScriptExit(unused)
in this case when server owner reload the fs will create anothers 3DT and Actor and CP in same positions and that can make same for #4 and can get server bugged sometimes (crashes)
what to do ?
you need to destory the actor / cp / 3DT you should add a variable for every one of (Create*) as TopShooter2 said
using arrays ammu[2] ammu[3] etc
and using those functions:
@RyderX :/
Sorry, but i wouldn't say that is a nice job
1- Not needed variables
PHP Code:
new gt = GetPlayerMoney(playerid);
like this:
PHP Code:
if(GetPlayerMoney(playerid) < 1500) return SendClientMessage(playerid, -1, "You Dont Have Enough Money!");
PHP Code:
ShowPlayerDialog(playerid,-1,0,"","","","");
PHP Code:
else return 1;
PHP Code:
if(dialogid == 2)
so better use this
PHP Code:
switch(dialogid)
and if you don't know id 1 or 0 in most gm's are already used, so that will make your dialogs unable to give back the informations and can make a crash in some cases
what to do ? use some ids +10k for make the ids confils impossible.
4 - The wrost idea ever
PHP Code:
public OnPlayerSpawn(playerid)
{
ammu1 = CreateDynamicCP( -2625.8235, 208.9246, 4.6171, 1.5, -1, -1, -1, 100.0);
Create3DTextLabel("[ENTER-AMMU]", COLOR_YELLOW, -2625.8235, 208.9246, 4.6171 + 0.2, 7.5, 0, 1);
ammu2 = CreateDynamicCP( 316.3988, -169.4865, 999.6010, 1.5, -1, -1, -1, 100.0);
Create3DTextLabel("[EXIT]", COLOR_YELLOW, 316.3988, -169.4865, 999.6010 + 0.2, 7.5, 0, 1);
ammu3 = CreateDynamicCP( 312.2126,-165.3139,999.6010, 1.5, -1, -1, -1, 100.0);
Create3DTextLabel("[BUY GUNS]", COLOR_YELLOW, 312.2126,-165.3139,999.6010 + 0.2, 7.5, 0, 1);
CreateActor( 179, 312.1635, -168.0826, 999.5938, 3.2477);
return 1;
}
so better change it to
PHP Code:
public OnFilterScriptInit()
as i see in your script you didn't touch OnFilterScriptExit(unused)
in this case when server owner reload the fs will create anothers 3DT and Actor and CP in same positions and that can make same for #4 and can get server bugged sometimes (crashes)
what to do ?
you need to destory the actor / cp / 3DT you should add a variable for every one of (Create*) as TopShooter2 said
using arrays ammu[2] ammu[3] etc
and using those functions:
PHP Code:
DestroyActor(actorid)
Delete3DTextLabel(Text3D:id)
DestroyDynamicCP(STREAMER_TAG_CP checkpointid)
Sorry, but i wouldn't say that is a nice job