[HELP] Simple question
#1

Just wondering if anyone could inform me what %s or %d etc do, what they are for, and how to use them?

I tried this;

pawn Код:
name=%d&killername=%d&hour=%d&minute=%d",deathname,killername,hour,minute
I just wondered whether I had done that right, and also what the %d does etc.

Regards,
XxCozzaxX
Reply
#2

Код:
 %s = string
Код:
 %d = numeric
How to use:
pawn Код:
new string[128],string2[128]; new name[MAX_PLAYER_NAME]; GetPlayerName(playerid, name,sizeof(name));
format(string2,sizeof(string2),"Your ID is: %d",playerid); // Your playerid
format(string,sizeof(string),"Your name is: %s",name); // Player name is a string
SendClientMessage(playerid, color, string);
SendClientMessage(playerid, color, string2);
Reply
#3

Brilliant, thankyou mate - I need to change them to %s then!

Regards,
XxCozzaxX
Reply
#4

Quote:
Originally Posted by XxCozzaxX
Посмотреть сообщение
pawn Код:
name=%d&killername=%d&hour=%d&minute=%d",deathname,killername,hour,minute
In that case, you need to change only name & killername to %s, hour & minute is numberic.
Reply
#5

Quote:
Originally Posted by FreshDoubleX
Посмотреть сообщение
In that case, you need to change only name & killername to %s, hour & minute is numberic.
Yeah, I realised this when I opened my game mode, thanks.

One problem though, my hour time is correct, but the minute is just displaying as 0, any explanations for this?

Here's my code;

pawn Код:
new hour, minute;
GetPlayerTime(playerid,hour,minute);
name=%s&killername=%s&hour=%d&minute=%d",deathname,killername,hour,minute
Regards,
XxCozzaxX
Reply
#6

pawn Код:
new hour, minute,string[128];
GetPlayerTime(playerid,hour,minute);
format(string,sizeof(string),"name: %s & killername: %s & hour: %d & minute: %d",deathname,killername,hour,minute);
SendClientMessage(playerid, 0xFF8811FF, string);
Reply
#7

Quote:
Originally Posted by blackwave
Посмотреть сообщение
pawn Код:
new hour, minute,string[128];
GetPlayerTime(playerid,hour,minute);
format(string,sizeof(string),"name: %s & killername: %s & hour: %d & minute: %d",deathname,killername,hour,minute);
SendClientMessage(playerid, 0xFF8811FF, string);
Sorry, I forgot to show my code;

pawn Код:
format(web,256,"www.cbsoftworks.co.uk/death.php?name=%s&killername=%s&hour=%d&minute=%d",deathname,killername,hour,minute);
HTTP(playerid,HTTP_POST,web,"",response);
Reply
#8

I dont use HTTP, since I dont post status on a site.

Here's the HTTP function structure: HTTP(index, type, "url", "data", callback);
Reply
#9

Okay, thanks very much, I have another issue which is getting on my nerves - probably extremely simple!

This is at the bottom of my code:
pawn Код:
dcmd_bond(params[])
    {
        if(lifted == 0)
        {
        MoveObject(bondlift,268.54293823242,1884.3603515625,16.081565856934,50000.0); //007lift up
        lifted = 1;
        }
        else
        {
            MoveObject(bondlift,268.70651245117,1884.0992431641,6.9150552749634,50000.0);//007lift down
            lifted = 0;
        }
        return 1;
        #pragma unused params
    }
And this is in onplayercommandtext;

pawn Код:
dcmd(bond,4,cmdtext);
but i'm getting 'argument type mismatch (argument 1)' on the line;
pawn Код:
dcmd(bond,4,cmdtext);
All of my other dcmd commands work perfectly using the same method.

Regards,
XxCozzaxX
Reply


Forum Jump:


Users browsing this thread: 2 Guest(s)