SA-MP Forums Archive
format(string, sizeof(string) [DOESNT SEND] - 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: format(string, sizeof(string) [DOESNT SEND] (/showthread.php?tid=425350)



format(string, sizeof(string) [DOESNT SEND] - Jaber_Brown - 25.03.2013

pawn Код:
if(strcmp(cmd, "/tazer", true) ==0)
    {
        if(IsPlayerConnected(playerid))
        {
            if(IsACop(playerid))
            {
                 if(GetPVarInt(playerid, "HasTazer") == 0) {

                        SetPVarInt(playerid, "HasTazer", 1);
                        GivePlayerWeapon(playerid, 23, 65500);
                        format(string, sizeof(string), "* %s unholsters his tazer", Account[playerid][pName]);
                }
                    else
                {

                    DeletePVar(playerid, "HasTazer");
                    SetPlayerAmmo(playerid, 23, 0);
                    format(string, sizeof(string), "* %s holsters his tazer", Account[playerid][pName]);
                }
               
            }
           
        }
        return 1;
    }
The commands appears and it give the player the gun, but the two sentence don't send


Re: format(string, sizeof(string) [DOESNT SEND] - Rock - 25.03.2013

Under format put:
pawn Код:
SendClientMessageToAll(playerid, string);



Re: format(string, sizeof(string) [DOESNT SEND] - Jaber_Brown - 25.03.2013

But I want to send it just to near by players


Re: format(string, sizeof(string) [DOESNT SEND] - Rock - 25.03.2013

Loop
IsPlayerInRangeOfPoint
SendClientMessage


Re: format(string, sizeof(string) [DOESNT SEND] - teomakedonija - 25.03.2013

pawn Код:
if(strcmp(cmd, "/tazer", true) ==0)
    {
        if(IsPlayerConnected(playerid))
        {
            if(IsACop(playerid))
            {
                 if(GetPVarInt(playerid, "HasTazer") == 0) {

                        SetPVarInt(playerid, "HasTazer", 1);
                        GivePlayerWeapon(playerid, 23, 65500);
                        format(string, sizeof(string), "* %s unholsters his tazer", Account[playerid][pName]);
                    ProxDetector(15.0,playerid,string, COLOR_PURPLE, COLOR_PURPLE, COLOR_PURPLE, COLOR_PURPLE);
                }
                    else
                {

                    DeletePVar(playerid, "HasTazer");
                    SetPlayerAmmo(playerid, 23, 0);
                    format(string, sizeof(string), "* %s holsters his tazer", Account[playerid][pName]);
                    ProxDetector(15.0,playerid,string, COLOR_PURPLE, COLOR_PURPLE, COLOR_PURPLE, COLOR_PURPLE);

                }
               
            }
           
        }
        return 1;
    }
Enjoy


Re: format(string, sizeof(string) [DOESNT SEND] - Luis- - 25.03.2013

Wheres the ProxDetector code?


Re: format(string, sizeof(string) [DOESNT SEND] - lean1337 - 25.03.2013

pawn Код:
if(strcmp(cmd, "/tazer", true) ==0)
    {
        if(IsPlayerConnected(playerid))
        {
            if(IsACop(playerid))
            {
                 if(GetPVarInt(playerid, "HasTazer") == 0) {

                        SetPVarInt(playerid, "HasTazer", 1);
                        GivePlayerWeapon(playerid, 23, 65500);
                        format(string, sizeof(string), "* %s unholsters his tazer", Account[playerid][pName]);
                   
                }
                    else
                {

                    DeletePVar(playerid, "HasTazer");
                    SetPlayerAmmo(playerid, 23, 0);
                    format(string, sizeof(string), "* %s holsters his tazer", Account[playerid][pName]);
                   
                }
                 ProxDetector(15.0,playerid,string, COLOR_PURPLE, COLOR_PURPLE, COLOR_PURPLE, COLOR_PURPLE);
               
            }
           
        }
        return 1;
    }
Looks better IMO and cleaner.


Re: format(string, sizeof(string) [DOESNT SEND] - Luis- - 25.03.2013

He's going to get errors with both codes.