[SOLVED] Simple question -
XxCozzaxX - 30.12.2010
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
Re: [HELP] Simple question -
blackwave - 30.12.2010
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);
Re: [HELP] Simple question -
XxCozzaxX - 30.12.2010
Brilliant, thankyou mate - I need to change them to %s then!
Regards,
XxCozzaxX
Re: [HELP] Simple question -
FreshDoubleX - 30.12.2010
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.
Re: [HELP] Simple question -
XxCozzaxX - 30.12.2010
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
Re: [HELP] Simple question -
blackwave - 30.12.2010
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);
Re: [HELP] Simple question -
XxCozzaxX - 30.12.2010
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);
Re: [HELP] Simple question -
blackwave - 30.12.2010
I dont use HTTP, since I dont post status on a site.
Here's the HTTP function structure: HTTP(index, type, "url", "data", callback);
Re: [HELP] Simple question -
XxCozzaxX - 30.12.2010
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;
but i'm getting 'argument type mismatch (argument 1)' on the line;
All of my other dcmd commands work perfectly using the same method.
Regards,
XxCozzaxX