hold off command? -
«XTC» - 26.06.2012
guys could somebody help me? i need to create a command that deattaches any attached object to player... but im a little noob in scripting... any help ? :S
Re: hold off command? -
park4bmx - 26.06.2012
I'm on my phone so can't show an example. It wha you want to do is
Loop through all the players object slots then check in that loop if there is an object in that slot if yes destro it
Re: hold off command? -
Randy More - 26.06.2012
pawn Code:
CMD:removemyobjects(playerid, params[])
{
for(new ao; ao < 10; ao++)
{
if(IsPlayerAttachedObjectSlotUsed(playerid, ao))
{
RemovePlayerAttachedObject(playerid, ao);
}
}
return 1;
}
Re: hold off command? -
«XTC» - 26.06.2012
hmmm thx randy
![Smiley](images/smilies/smile.png)
just a question... i dont use zcmd , i use a_samp include to script...so does a_samp support this script too?
Re: hold off command? -
vital2k - 26.06.2012
If you use no command plugin such as zcmd or ycmd then no this won't work. However I do recommend using a plugin such as those, it will make your life so much easier.
Re: hold off command? -
Randy More - 26.06.2012
I recommend you use ZCMD, however, a normal command that you will have to put under OnPlayerCommandText callback:
pawn Code:
if(!strcmp(cmdtext,"/removemyobjects", true)) // If the command submitted.
{
for(new ao; ao < 10; ao++) // This loops through the ten slots, so all codes between the for braces will happen for the ten
{
if(IsPlayerAttachedObjectSlotUsed(playerid, ao)) // Checks if the slots are used.
{
RemovePlayerAttachedObject(playerid, ao); // If so remove the object(s).
}
}
return 1;
}
Re: hold off command? -
«XTC» - 26.06.2012
yeah but isn't a_samp good for a person who wants to start learning pawn language?
Re: hold off command? -
park4bmx - 26.06.2012
a_samp
is
requirde in order to make any script for samp!
not just a command processor
it has all other functions like: GiveMoney,Weather etc.
Re: hold off command? -
vital2k - 26.06.2012
a_samp isn't just for things like commands, it defines everything the the compiler/editor needs to know for the script to work. If you used to the syntax of pawn then I wouldn't worry too much and use ZCMD any way as the only thing the default method does it add unnecessary complications.
Re: hold off command? -
«XTC» - 26.06.2012
well i scripted the beta version of my server by using a_samp ... ill try to create the next version with zcmd
![Grin](images/smilies/biggrin.gif)
thx for helping guys
![Smiley](images/smilies/smile.png)
also ...
@Randy More : i tried your script...it compiled successfully but when i try this command...nothing works in game
Re: hold off command? -
vital2k - 26.06.2012
Like I said, if you are not using the plugin then the command will not work.
Re: hold off command? -
park4bmx - 26.06.2012
yes it will just use this
pawn Code:
stock RemovePlayerAttachedObjects(playerid)
{
new numfound;
for(new i=0; i<MAX_PLAYER_ATTACHED_OBJECTS; i++)
{
if(IsPlayerAttachedObjectSlotUsed(playerid, i)){
RemovePlayerAttachedObject(playerid,i)
numfound++;
}
}
return
}
//then later on use it like this(any where)
RemovePlayerAttachedObjects(playerid);
//also it can return how many objects were found example
new objects = RemovePlayerAttachedObjects(playerid);
printf("objects found: %d",objects);
Re: hold off command? -
«XTC» - 26.06.2012
Edit: Fixed
![Wink](images/smilies/wink.png)
thanks so much guys
![Smiley](images/smilies/smile.png)
also... +1 to park4bmx