SA-MP Forums Archive
script help - 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: script help (/showthread.php?tid=628738)



script help - crukk11 - 14.02.2017

i compile this code

CMD:givegun(playerid, params[]){
new wid, ammo, str[128], pName[MAX_PLAYER_NAME];
if(sscanf(params, "ui", wid, ammo)) return SendClientMessage(playerid, -1, "USAGE: /givegun [weapon id] [ammo]");
if(wid == 3 return SendClientMessage(playerid, 0xFF0000, "ERROR: weapond id 38 is forbidden");
GetPlayerName(playerid, pName, sizeof(pName));
GivePlayerWeapon(playerid, wid, ammo);
format(str,sizeof(str),"You got Weapon ID %i",wid);
SendClientMessage(playerid, 0xf8f8f8fff, str);
return 1;
}

when i compile it i got the code is ok

but when i run the server is crash

help RyderX

p.sorry for my bad english


Re: script help - RyderX - 14.02.2017

Quote:
Originally Posted by crukk11
Посмотреть сообщение
i compile this code

CMD:givegun(playerid, params[]){
new wid, ammo, str[128], pName[MAX_PLAYER_NAME];
if(sscanf(params, "ui", wid, ammo)) return SendClientMessage(playerid, -1, "USAGE: /givegun [weapon id] [ammo]");
if(wid == 3 return SendClientMessage(playerid, 0xFF0000, "ERROR: weapond id 38 is forbidden");
GetPlayerName(playerid, pName, sizeof(pName));
GivePlayerWeapon(playerid, wid, ammo);
format(str,sizeof(str),"You got Weapon ID %i",wid);
SendClientMessage(playerid, 0xf8f8f8fff, str);
return 1;
}

when i compile it i got the code is ok

but when i run the server is crash

help RyderX

p.sorry for my bad english
PHP код:
CMD:givegun(playeridparams[]){  
    new 
widammostr[128], pName[MAX_PLAYER_NAME];  
    if(
sscanf(params"ui",  widammo)) return SendClientMessage(playerid, -1"USAGE: /givegun [weapon id] [ammo]");  
    if(
wid == 38) return SendClientMessage(playerid0xFF0000"ERROR: weapond id 38 is forbidden");  
    
GetPlayerName(playeridpNamesizeof(pName));  
    
GivePlayerWeapon(playeridwidammo);  
    
format(str,sizeof(str),"You got Weapon ID %i With %i Ammo",wid,ammo); 
    
SendClientMessage(playerid0xf8f8f8fffstr); 
    return 
1;  

Try now


Re: script help - crukk11 - 14.02.2017

same crash

it say script [Gamemode/GL]: Run Time error 19: ''File or function is not found''


Re: script help - Rdx - 14.02.2017

Probably sscanf plugin is not loaded.


Re: script help - crukk11 - 14.02.2017

not work


Re: script help - RyderX - 14.02.2017

Crukk1 can you copy all , server-log.txt to here let me see it


Re: script help - crukk11 - 14.02.2017

when i enter the command it nothing happen

thank rdx for your help


Re: script help - SyS - 14.02.2017

The crash is not from your code. It's because one of dependencies are not loaded. Most probably its sscanf or the file itself.


Re: script help - RyderX - 14.02.2017

Quote:
Originally Posted by crukk11
Посмотреть сообщение
when i enter the command it nothing happen

thank rdx for your help
So it works?


Re: script help - crukk11 - 14.02.2017

it work but the command nothing happen when i enter it