Event Command.
#1

Hi Guyz,
I need some help,i have made startevent command but when i type it in game the text i have written in pwn doesn't displays on screen please help me,this is my code
PHP код:
CMD:startevent(playerid,params[])
{
    new 
ename; new eprize; new gun; new ammo; new string[128]; new estring[128]; new joinable=0;
     if(!
IsPlayerAdmin(playerid)) return    SendClientMessage(playerid,COLOR_ERROR,"Unknown command type /cmds for the full list of commands!");
    if(
joinable==1) return SendClientMessage(playerid,COLOR_ERROR,"There Is Already An Event Going On.");
    else if(
sscanf(params,"s[128]iiii",ename,eprize,gun,ammo))
    return 
SendClientMessage(playerid,COLOR_ERROR,"/startevent [Event Name] [Prize] [Weapon] [Ammo]");
    else if(
gun 39 || gun 0) return SendClientMessage(playerid,COLOR_ERROR,"This Weapon Can Get That Player Ban!");
    else
    {
    
format(string,128,"'%s' has been started as an event! Use /join to join the fun!",ename);
    
SendClientMessageToAll(COLOR_CYAN,string);
    
format(estring,128,"~n~~n~~b~'%s' ~w~has been started!~w~Use ~g~/join to join the fun!",ename);
    
GameTextForAll(estring,5000,5);
     
joinable=1;
     new 
Float:XFloat:YFloat:Z;
     
GetPlayerPos(playerid,X,Y,Z);
     
SetPlayerPos(playerid,X,Y,Z);
     }
     return 
1;

Reply
#2

If you put
PHP код:
print("[Debug] CMD:startevent has been called."); 
before the first line with
PHP код:
new ename
, does it print that to the console?
Reply
#3

I Can't Understand brah
Reply
#4

Use this:
PHP код:
CMD:startevent(playerid,params[]) 

     print(
"[Debug] CMD:startevent has been called.");  
     new 
ename; new eprize; new gun; new ammo; new string[128]; new estring[128]; new joinable=0
     if(!
IsPlayerAdmin(playerid)) return    SendClientMessage(playerid,COLOR_ERROR,"Unknown command type /cmds for the full list of commands!"); 
    if(
joinable==1) return SendClientMessage(playerid,COLOR_ERROR,"There Is Already An Event Going On."); 
    else if(
sscanf(params,"s[128]iiii",ename,eprize,gun,ammo)) 
    return 
SendClientMessage(playerid,COLOR_ERROR,"/startevent [Event Name] [Prize] [Weapon] [Ammo]"); 
    else if(
gun 39 || gun 0) return SendClientMessage(playerid,COLOR_ERROR,"This Weapon Can Get That Player Ban!"); 
    else 
    { 
    
format(string,128,"'%s' has been started as an event! Use /join to join the fun!",ename); 
    
SendClientMessageToAll(COLOR_CYAN,string); 
    
format(estring,128,"~n~~n~~b~'%s' ~w~has been started!~w~Use ~g~/join to join the fun!",ename); 
    
GameTextForAll(estring,5000,5); 
     
joinable=1
     new 
Float:XFloat:YFloat:Z
     
GetPlayerPos(playerid,X,Y,Z); 
     
SetPlayerPos(playerid,X,Y,Z); 
     } 
     return 
1

Reply
#5

Not Working,again and again:/startevent [Event Name] [Prize] [Weapon] [Ammo]
Reply
#6

Did the message print to your console? (Show your server log maybe?)
Reply
#7

No didn't worked
PHP код:
SA-MP Dedicated Server
----------------------
v0.3.7, (C)2005-2015 SA-MP Team
[12:28:51plugins ""  (string)
[
12:28:51
[
12:28:51Server Plugins
[12:28:51] --------------
[
12:28:51]  Loaded 0 plugins.
[
12:28:51
[
12:28:51Filterscripts
[12:28:51] ---------------
[
12:28:51]   Loading filterscript 'DD.amx'...
[
12:28:51]   Loaded 1 filterscripts.
[
12:28:51
----------------------------------
[
12:28:51]  Total TDM Script
[12:28:51] ----------------------------------
[
12:28:51Number of vehicle models8
[12:29:15] [connection192.168.35.100:62817 requests connection cookie.
[
12:29:16Incoming connection192.168.35.100:62817 id0
[12:29:16] [join] ..Sup.. has joined the server (0:192.168.35.100)
[
12:29:40RCON (In-Game): Player #0 (..Sup..) failed login.
[12:29:44RCON (In-Game): Player #0 (..Sup..) has logged in.
[12:29:48] [DebugCMD:startevent has been called.
[
12:30:01] [DebugCMD:startevent has been called.
[
12:31:01] [part] ..Sup.. has left the server (0:1
Reply
#8

Sscanf line is wrong, 5 specifiers vs 4 variables. Also "joinable" is completely useless because it is a local variable. It gets discarded when the function ends.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)