if any one tell me??? [+REP]
#1

Please anyone tell me that how i can script campare string fucntion
Reply
#2

There's strcmp which already exists.

But if you want to script your own, you have to do a loop through each cell of both string and comparing if the cell x from string 1 equals to the cell x from string 2.
If it does, simply use "continue;". If it doesn't, use "return false;" for example or return anything you want when the strings aren't identic.
Reply
#3

I think the easiest way is to just use strcmp for that, here's an example of one I made:

pawn Код:
CMD:key(pid, arg[])
{
    if(IsPlayerInAnyVehicle(pid))
    {
        new vehicleid = GetPlayerVehicleID(pid);
       
        new choice[5], engine, lights, alarm, doors, bonnet, boot, objective;

        GetVehicleParamsEx(vehicleid, engine, lights, alarm, doors, bonnet, boot, objective);
       
        if(sscanf(arg, "s[5]", choice)) return  SendMessage(pid, 2, "/key [off][on][acc]");
        if(!strcmp(choice, "off"))
        {
Reply
#4

Quote:
Originally Posted by S4t3K
Посмотреть сообщение
There's strcmp which already exists.

But if you want to script your own, you have to do a loop through each cell of both string and comparing if the cell x from string 1 equals to the cell x from string 2.
If it does, simply use "continue;". If it doesn't, use "return false;" for example or return anything you want when the strings aren't identic.
my means is tah tthe player with my community tag such as [PG]hereplayername can't enter to server without my premission or any admin premission if you know so please tell me the codes and get +REP according to title!
Reply
#5

PHP код:

stock IsPlayerNameHasPGInside
(playerid)
{
      new 
playername[MAX_PLAYER_NAME+1], teamtag[5];
      
GetPlayerName(playeridplayername25);
      
strmid(teamtagplayername04);
      if(!
strcmp(teamtag"[PG]")) return true;
      return 
false;
}
public 
OnPlayerConnect(playerid)
{
      if(
IsPlayerNameHasPGInside(playerid)) KickWithMessage(playerid, -1"You use the [PG] team tag which isn't allowed !");
      return 
1;

The function name's pretty ugly but feel free to edit it.
Reply
#6

oooohhhh, you want to use strfind. https://sampwiki.blast.hk/wiki/Strfind

check it for any special symbols, ![]{}$#@ etc.
Reply
#7

than when i set name the player then the players can enter
Reply
#8

s43tk please contact me via skype my skype name is aisam.scripter hurry
Reply


Forum Jump:


Users browsing this thread: 5 Guest(s)